From b4b1dde8fdd745433ae7b790c7d72118a7297549 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Mon, 26 Jan 2009 08:57:13 -0600 Subject: [PATCH] Update Tests Functional Test for the new behaviour of Revisions 344-345. --- test/functional/file_controller_test.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/functional/file_controller_test.rb b/test/functional/file_controller_test.rb index 610794b6..779a4d74 100755 --- a/test/functional/file_controller_test.rb +++ b/test/functional/file_controller_test.rb @@ -24,7 +24,7 @@ class FileControllerTest < Test::Unit::TestCase @wiki = Wiki.new WikiFile.delete_all require 'fileutils' - FileUtils.rm_rf("#{RAILS_ROOT}/webs/wiki1/files/*") + FileUtils.rm_rf("#{RAILS_ROOT}/webs/wiki1/files") end def test_file_upload_form @@ -42,6 +42,19 @@ class FileControllerTest < Test::Unit::TestCase assert_response(:success, bypass_body_parsing = true) assert_equal "Contents of the file", r.body assert_equal 'text/plain', r.headers['type'] + assert_equal 'inline; filename="foo.txt"', r.headers['Content-Disposition'] + end + + def test_file_download_html_file + @web.wiki_files.create(:file_name => 'foo.html', :description => 'Text file', + :content => "Contents of the file") + + r = get :file, :web => 'wiki1', :id => 'foo.html' + + assert_response(:success, bypass_body_parsing = true) + assert_equal "Contents of the file", r.body + assert_equal 'application/octet-stream', r.headers['type'] + assert_equal 'attachment; filename="foo.html"', r.headers['Content-Disposition'] end def test_file_download_pdf_file @@ -65,6 +78,7 @@ class FileControllerTest < Test::Unit::TestCase assert_equal 'image/gif', r.headers['type'] assert_equal pic.size, r.body.size assert_equal pic, r.body + assert_equal 'inline; filename="rails.gif"', r.headers['Content-Disposition'] end def test_pic_unknown_pic