Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6805 from tim-vandecasteele/uploadedfile-paramify

Don't paramify ActionDispatch::Http::UploadedFile in tests
  • Loading branch information...
commit ebe8a45444fb42b42768fba826f56a498c8b389a 2 parents 5fb21ba + 8471edc
@carlosantoniodasilva carlosantoniodasilva authored
View
2  actionpack/lib/action_controller/test_case.rb
@@ -450,7 +450,7 @@ def paramify_values(hash_or_array_or_value)
Hash[hash_or_array_or_value.map{|key, value| [key, paramify_values(value)] }]
when Array
hash_or_array_or_value.map {|i| paramify_values(i)}
- when Rack::Test::UploadedFile
+ when Rack::Test::UploadedFile, ActionDispatch::Http::UploadedFile
hash_or_array_or_value
else
hash_or_array_or_value.to_param
View
7 actionpack/test/controller/test_case_test.rb
@@ -813,6 +813,13 @@ def test_fixture_file_upload
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
Please sign in to comment.
Something went wrong with that request. Please try again.