mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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:
parent
394b7be036
commit
140d5a3b2f
1 changed files with 2 additions and 2 deletions
|
@ -908,7 +908,7 @@ XML
|
|||
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 @@ XML
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue