aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-07-23 15:51:05 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-07-23 15:51:05 -0500
commitdf698991612575fe015d27bc138c5111de384c15 (patch)
tree3fd960699580556189289cec6071da81eb4c1a33 /test
parent15efa6720f9dc6efe27c717d9e32b31b2d45b7b8 (diff)
parent4efbeaeaab72be070e203f39726b37703c1db1fa (diff)
downloadrails-df698991612575fe015d27bc138c5111de384c15.tar.gz
rails-df698991612575fe015d27bc138c5111de384c15.tar.bz2
rails-df698991612575fe015d27bc138c5111de384c15.zip
Merge branch 'master' of github.com:rails/activestorage
Diffstat (limited to 'test')
-rw-r--r--test/controllers/direct_uploads_controller_test.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/controllers/direct_uploads_controller_test.rb b/test/controllers/direct_uploads_controller_test.rb
index 06e76cfa8b..60b15b1fdd 100644
--- a/test/controllers/direct_uploads_controller_test.rb
+++ b/test/controllers/direct_uploads_controller_test.rb
@@ -22,10 +22,10 @@ if SERVICE_CONFIGURATIONS[:s3]
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 @@ if SERVICE_CONFIGURATIONS[:gcs]
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