diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-23 13:19:32 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-23 13:19:32 -0500 |
commit | 347dc166324c108b4a9c25c5ab03222a2f42b1d0 (patch) | |
tree | a268301da79b96278bc99439812f8c2c034fd000 /test | |
parent | c285c6824dc186e00040b7283877fea917050275 (diff) | |
download | rails-347dc166324c108b4a9c25c5ab03222a2f42b1d0.tar.gz rails-347dc166324c108b4a9c25c5ab03222a2f42b1d0.tar.bz2 rails-347dc166324c108b4a9c25c5ab03222a2f42b1d0.zip |
VerifiedKeyWithExpiration no longer needed
Thanks to rails/rails#29854! This does mean that we now depend on rails/rails master.
Diffstat (limited to 'test')
-rw-r--r-- | test/controllers/disk_controller_test.rb | 4 | ||||
-rw-r--r-- | test/models/blob_test.rb | 3 | ||||
-rw-r--r-- | test/models/verified_key_with_expiration_test.rb | 20 |
3 files changed, 3 insertions, 24 deletions
diff --git a/test/controllers/disk_controller_test.rb b/test/controllers/disk_controller_test.rb index 3e3f70de7a..c427942c57 100644 --- a/test/controllers/disk_controller_test.rb +++ b/test/controllers/disk_controller_test.rb @@ -11,13 +11,13 @@ class ActiveStorage::DiskControllerTest < ActionController::TestCase end test "showing blob inline" do - get :show, params: { filename: @blob.filename, encoded_key: ActiveStorage::VerifiedKeyWithExpiration.encode(@blob.key, expires_in: 5.minutes) } + get :show, params: { filename: @blob.filename, encoded_key: ActiveStorage.verifier.generate(@blob.key, expires_in: 5.minutes) } assert_equal "inline; filename=\"#{@blob.filename}\"", @response.headers["Content-Disposition"] assert_equal "text/plain", @response.headers["Content-Type"] end test "sending blob as attachment" do - get :show, params: { filename: @blob.filename, encoded_key: ActiveStorage::VerifiedKeyWithExpiration.encode(@blob.key, expires_in: 5.minutes), disposition: :attachment } + get :show, params: { filename: @blob.filename, encoded_key: ActiveStorage.verifier.generate(@blob.key, expires_in: 5.minutes), disposition: :attachment } assert_equal "attachment; filename=\"#{@blob.filename}\"", @response.headers["Content-Disposition"] assert_equal "text/plain", @response.headers["Content-Type"] end diff --git a/test/models/blob_test.rb b/test/models/blob_test.rb index ded11e5dbe..45c8b7168f 100644 --- a/test/models/blob_test.rb +++ b/test/models/blob_test.rb @@ -1,6 +1,5 @@ require "test_helper" require "database/setup" -require "active_storage/verified_key_with_expiration" class ActiveStorage::BlobTest < ActiveSupport::TestCase test "create after upload sets byte size and checksum" do @@ -36,6 +35,6 @@ class ActiveStorage::BlobTest < ActiveSupport::TestCase private def expected_url_for(blob, disposition: :inline) - "/rails/active_storage/disk/#{ActiveStorage::VerifiedKeyWithExpiration.encode(blob.key, expires_in: 5.minutes)}/#{blob.filename}?disposition=#{disposition}" + "/rails/active_storage/disk/#{ActiveStorage.verifier.generate(blob.key, expires_in: 5.minutes)}/#{blob.filename}?disposition=#{disposition}" end end diff --git a/test/models/verified_key_with_expiration_test.rb b/test/models/verified_key_with_expiration_test.rb deleted file mode 100644 index dd69e7cb10..0000000000 --- a/test/models/verified_key_with_expiration_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require "test_helper" -require "active_support/core_ext/securerandom" -require "active_storage/verified_key_with_expiration" - -class ActiveStorage::VerifiedKeyWithExpirationTest < ActiveSupport::TestCase - FIXTURE_KEY = SecureRandom.base58(24) - - test "without expiration" do - encoded_key = ActiveStorage::VerifiedKeyWithExpiration.encode(FIXTURE_KEY) - assert_equal FIXTURE_KEY, ActiveStorage::VerifiedKeyWithExpiration.decode(encoded_key) - end - - test "with expiration" do - encoded_key = ActiveStorage::VerifiedKeyWithExpiration.encode(FIXTURE_KEY, expires_in: 1.minute) - assert_equal FIXTURE_KEY, ActiveStorage::VerifiedKeyWithExpiration.decode(encoded_key) - - travel 2.minutes - assert_nil ActiveStorage::VerifiedKeyWithExpiration.decode(encoded_key) - end -end |