aboutsummaryrefslogtreecommitdiffstats
path: root/test/site/gcs_site_test.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2017-07-04 14:01:03 -0400
committerGeorge Claghorn <george@basecamp.com>2017-07-04 14:01:03 -0400
commit5159d030fad632ac544555541ab1c85ac132874e (patch)
tree5182fd6b7d074f0cbabcb1dfd4d9501b32c5e5de /test/site/gcs_site_test.rb
parente635dac88f0dfcc36a2313c10f860cb6e3a52cfa (diff)
downloadrails-5159d030fad632ac544555541ab1c85ac132874e.tar.gz
rails-5159d030fad632ac544555541ab1c85ac132874e.tar.bz2
rails-5159d030fad632ac544555541ab1c85ac132874e.zip
ActiveFile::Site::GCSSite#url
Diffstat (limited to 'test/site/gcs_site_test.rb')
-rw-r--r--test/site/gcs_site_test.rb10
1 files changed, 9 insertions, 1 deletions
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"