diff --git a/test/controllers/direct_uploads_controller_test.rb b/test/controllers/direct_uploads_controller_test.rb index 06e76cfa8bc02b7b25ebcf315c4108a9a2f98253..60b15b1fddee73b6e680ee029810aeb474139b46 100644 --- a/test/controllers/direct_uploads_controller_test.rb +++ b/test/controllers/direct_uploads_controller_test.rb @@ -22,10 +22,10 @@ class ActiveStorage::S3DirectUploadsControllerTest < ActionController::TestCase post :create, params: { blob: { filename: "hello.txt", byte_size: 6, checksum: Digest::MD5.base64digest("Hello"), content_type: "text/plain" } } - details = JSON.parse(@response.body) - - assert_match /#{SERVICE_CONFIGURATIONS[:s3][:bucket]}\.s3.(\S+)?amazonaws\.com/, details["upload_to_url"] - assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s + @response.parsed_body.tap do |details| + assert_match(/#{SERVICE_CONFIGURATIONS[:s3][:bucket]}\.s3.(\S+)?amazonaws\.com/, details["upload_to_url"]) + assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s + end end end else @@ -52,10 +52,10 @@ class ActiveStorage::GCSDirectUploadsControllerTest < ActionController::TestCase post :create, params: { blob: { filename: "hello.txt", byte_size: 6, checksum: Digest::MD5.base64digest("Hello"), content_type: "text/plain" } } - details = JSON.parse(@response.body) - - assert_match %r{storage\.googleapis\.com/#{@config[:bucket]}}, details["upload_to_url"] - assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s + @response.parsed_body.tap do |details| + assert_match %r{storage\.googleapis\.com/#{@config[:bucket]}}, details["upload_to_url"] + assert_equal "hello.txt", ActiveStorage::Blob.find_signed(details["signed_blob_id"]).filename.to_s + end end end else