From 5159d030fad632ac544555541ab1c85ac132874e Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Tue, 4 Jul 2017 14:01:03 -0400 Subject: ActiveFile::Site::GCSSite#url --- test/site/gcs_site_test.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test/site/gcs_site_test.rb') diff --git a/test/site/gcs_site_test.rb b/test/site/gcs_site_test.rb index c5f32a0595..f6848b2fe9 100644 --- a/test/site/gcs_site_test.rb +++ b/test/site/gcs_site_test.rb @@ -2,9 +2,17 @@ require "site/shared_site_tests" if SITE_CONFIGURATIONS[:gcs] class ActiveFile::Site::GCSSiteTest < ActiveSupport::TestCase - SITE = ActiveFile::Site.configure(:GCS, SITE_CONFIGURATIONS[:gcs]) + SITE = ActiveFile::Site.configure(:GCS, SITE_CONFIGURATIONS[:gcs]) + SIGNER = Google::Cloud::Storage::File::Signer.from_bucket(SITE.bucket, ActiveFile::Site::SharedSiteTests::FIXTURE_KEY) 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") + end + end end else puts "Skipping GCS Site tests because no GCS configuration was supplied" -- cgit v1.2.3