Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
Functional Test for the new behaviour of Revisions 344-345.
  • Loading branch information
distler committed Jan 26, 2009
1 parent 34fd7b4 commit b4b1dde
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/functional/file_controller_test.rb
Expand Up @@ -24,7 +24,7 @@ class << @request.session
@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
Expand All @@ -42,6 +42,19 @@ def test_file_download_text_file
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
Expand All @@ -65,6 +78,7 @@ def test_pic_download_gif
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
Expand Down

0 comments on commit b4b1dde

Please sign in to comment.