1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Eliminate SIGNER

This commit is contained in:
George Claghorn 2017-07-04 14:12:20 -04:00
parent 5159d030fa
commit 4f6410795c

View file

@ -2,15 +2,16 @@ require "site/shared_site_tests"
if SITE_CONFIGURATIONS[:gcs]
class ActiveFile::Site::GCSSiteTest < ActiveSupport::TestCase
SITE = ActiveFile::Site.configure(:GCS, SITE_CONFIGURATIONS[:gcs])
SIGNER = Google::Cloud::Storage::File::Signer.from_bucket(SITE.bucket, ActiveFile::Site::SharedSiteTests::FIXTURE_KEY)
SITE = ActiveFile::Site.configure(:GCS, SITE_CONFIGURATIONS[:gcs])
include ActiveFile::Site::SharedSiteTests
test "signed URL generation" do
travel_to Time.now do
assert_equal SIGNER.signed_url(expires: 120) + "&response-content-disposition=inline%3B+filename%3D%22test.txt%22",
@site.url(FIXTURE_KEY, expires_in: 2.minutes, disposition: :inline, filename: "test.txt")
url = SITE.bucket.signed_url(path: FIXTURE_KEY, expires: 120) +
"&response-content-disposition=inline%3B+filename%3D%22test.txt%22"
assert_equal url, @site.url(FIXTURE_KEY, expires_in: 2.minutes, disposition: :inline, filename: "test.txt")
end
end
end