use Rack::Test::UploadedFile when uploading files

We should use rack-test's upload file objects on the test side so that
we will be able to correctly generate mime blob posts in the future
This commit is contained in:
Aaron Patterson 2015-07-09 11:51:45 -07:00
parent 394b7be036
commit 140d5a3b2f

@ -908,7 +908,7 @@ def test_deprecated_action_dispatch_uploaded_file_upload
filename = 'mona_lisa.jpg'
path = "#{FILES_DIR}/#{filename}"
assert_deprecated {
post :test_file_upload, file: ActionDispatch::Http::UploadedFile.new(filename: path, type: "image/jpg", tempfile: File.open(path))
post :test_file_upload, file: Rack::Test::UploadedFile.new(path, "image/jpg", true)
}
assert_equal '159528', @response.body
end
@ -917,7 +917,7 @@ def test_action_dispatch_uploaded_file_upload
filename = 'mona_lisa.jpg'
path = "#{FILES_DIR}/#{filename}"
post :test_file_upload, params: {
file: ActionDispatch::Http::UploadedFile.new(filename: path, type: "image/jpg", tempfile: File.open(path))
file: Rack::Test::UploadedFile.new(path, "image/jpg", true)
}
assert_equal '159528', @response.body
end