From 46da4ee7daf1ecaa2fc47a260ccb58e119a1b5ea Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 23 Jul 2017 11:05:20 -0500 Subject: Switch to simpler signed_id for blob rather than full GlobalID We don't need to lookup multiple different classes, so no need to use a globalid. --- test/controllers/direct_uploads_controller_test.rb | 8 ++++---- test/controllers/variants_controller_test.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test/controllers') diff --git a/test/controllers/direct_uploads_controller_test.rb b/test/controllers/direct_uploads_controller_test.rb index 0083492929..06e76cfa8b 100644 --- a/test/controllers/direct_uploads_controller_test.rb +++ b/test/controllers/direct_uploads_controller_test.rb @@ -24,8 +24,8 @@ if SERVICE_CONFIGURATIONS[:s3] details = JSON.parse(@response.body) - assert_match /#{SERVICE_CONFIGURATIONS[:s3][:bucket]}\.s3.(\S+)?amazonaws\.com/, details["url"] - assert_equal "hello.txt", GlobalID::Locator.locate_signed(details["sgid"]).filename.to_s + 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 else @@ -54,8 +54,8 @@ if SERVICE_CONFIGURATIONS[:gcs] details = JSON.parse(@response.body) - assert_match %r{storage\.googleapis\.com/#{@config[:bucket]}}, details["url"] - assert_equal "hello.txt", GlobalID::Locator.locate_signed(details["sgid"]).filename.to_s + 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 else diff --git a/test/controllers/variants_controller_test.rb b/test/controllers/variants_controller_test.rb index d2b5c32df7..8d437bedbb 100644 --- a/test/controllers/variants_controller_test.rb +++ b/test/controllers/variants_controller_test.rb @@ -14,7 +14,7 @@ class ActiveStorage::VariantsControllerTest < ActionController::TestCase test "showing variant inline" do get :show, params: { filename: @blob.filename, - encoded_blob_key: ActiveStorage::VerifiedKeyWithExpiration.encode(@blob.key, expires_in: 5.minutes), + signed_blob_id: @blob.signed_id, variation_key: ActiveStorage::Variation.encode(resize: "100x100") } assert_redirected_to /racecar.jpg\?disposition=inline/ -- cgit v1.2.3