aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorTim Vandecasteele <tim.vandecasteele@vasco.com>2012-06-21 10:16:28 +0200
committerMorton Jonuschat <yabawock@gmail.com>2012-09-29 16:31:10 +0200
commitc53e5def08f7a289a92a8e5f79dcd7caa5c3a2fb (patch)
treeddbf0b3a1b464d65bccd0966150ea7d217311fba /actionpack/test
parent8ca05c2ea2726671b46249a51dc9f5d44e965d46 (diff)
downloadrails-c53e5def08f7a289a92a8e5f79dcd7caa5c3a2fb.tar.gz
rails-c53e5def08f7a289a92a8e5f79dcd7caa5c3a2fb.tar.bz2
rails-c53e5def08f7a289a92a8e5f79dcd7caa5c3a2fb.zip
Don't paramify ActionDispatch::Http::UploadedFile in tests
To test uploading a file without using fixture_file_upload, a posted ActionDispatch::Http::UploadedFile should not be paramified (just like Rack::Test::UploadedFile). (Rack::Test::UploadedFile and ActionDispatch::Http::UploadedFile don't share the same API, tempfile is not accessible on Rack::Test::UploadedFile as discussed in https://github.com/brynary/rack-test/issues/30)
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/test_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index 6a5843f9d7..677a933ccb 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -766,6 +766,13 @@ XML
assert_equal '159528', @response.body
end
+ def test_action_dispatch_uploaded_file_upload
+ filename = 'mona_lisa.jpg'
+ path = "#{FILES_DIR}/#{filename}"
+ post :test_file_upload, :file => ActionDispatch::Http::UploadedFile.new(:filename => path, :type => "image/jpg", :tempfile => File.open(path))
+ assert_equal '159528', @response.body
+ end
+
def test_test_uploaded_file_exception_when_file_doesnt_exist
assert_raise(RuntimeError) { Rack::Test::UploadedFile.new('non_existent_file') }
end