Sync with Instiki Trunk

Sync with Revision 519 of Instiki trunk (2007/5/7).
This commit is contained in:
Jacques Distler 2007-05-11 11:47:38 -05:00
parent b0e063451f
commit 3b6cd309ff
21 changed files with 173 additions and 158 deletions

View file

@ -24,8 +24,8 @@ class FileControllerTest < Test::Unit::TestCase
def test_file_upload_form
get :file, :web => 'wiki1', :id => 'new_file.txt'
assert_success
assert_rendered_file 'file/file'
assert_response(:success)
assert_template 'file/file'
end
def test_file_download_text_file
@ -34,7 +34,7 @@ class FileControllerTest < Test::Unit::TestCase
r = get :file, :web => 'wiki1', :id => 'foo.txt'
assert_success(bypass_body_parsing = true)
assert_response(:success, bypass_body_parsing = true)
assert_equal "Contents of the file", r.body
assert_equal 'text/plain', r.headers['Content-Type']
end
@ -45,7 +45,7 @@ class FileControllerTest < Test::Unit::TestCase
r = get :file, :web => 'wiki1', :id => 'foo.pdf'
assert_success(bypass_body_parsing = true)
assert_response(:success, bypass_body_parsing = true)
assert_equal "aaa\nbbb\n", r.body
assert_equal 'application/pdf', r.headers['Content-Type']
end
@ -56,7 +56,7 @@ class FileControllerTest < Test::Unit::TestCase
r = get :file, :web => 'wiki1', :id => 'rails.gif'
assert_success(bypass_body_parsing = true)
assert_response(:success, bypass_body_parsing = true)
assert_equal 'image/gif', r.headers['Content-Type']
assert_equal pic.size, r.body.size
assert_equal pic, r.body
@ -65,8 +65,8 @@ class FileControllerTest < Test::Unit::TestCase
def test_pic_unknown_pic
r = get :file, :web => 'wiki1', :id => 'non-existant.gif'
assert_success
assert_rendered_file 'file/file'
assert_response(:success)
assert_template 'file/file'
end
def test_pic_upload_end_to_end
@ -81,12 +81,13 @@ class FileControllerTest < Test::Unit::TestCase
# rails-e2e.gif is unknown to the system, so pic action goes to the file [upload] form
r = get :file, :web => 'wiki1', :id => 'rails-e2e.gif'
assert_success
assert_rendered_file 'file/file'
assert_response(:success)
assert_template 'file/file'
# User uploads the picture
picture = File.read("#{RAILS_ROOT}/test/fixtures/rails.gif")
r = post :file, :web => 'wiki1',
# updated from post to get - post fails the spam protection (no javascript)
r = get :file, :web => 'wiki1',
:file => {:file_name => 'rails-e2e.gif', :content => StringIO.new(picture)}
assert_redirected_to({})
assert @web.has_file?('rails-e2e.gif')
@ -94,8 +95,9 @@ class FileControllerTest < Test::Unit::TestCase
end
def test_import
r = post :import, :web => 'wiki1', :file => uploaded_file("#{RAILS_ROOT}/test/fixtures/exported_markup.zip")
assert_redirect
# updated from post to get - post fails the spam protection (no javascript)
r = get :import, :web => 'wiki1', :file => uploaded_file("#{RAILS_ROOT}/test/fixtures/exported_markup.zip")
assert_response(:redirect)
assert @web.has_page?('ImportedPage')
end