aboutsummaryrefslogtreecommitdiffstats
path: root/test/site/gcs_site_test.rb
blob: 98b1a3d767f6da3d4a1cb237b20c8d42fd59adf8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require "site/shared_site_tests"

if SITE_CONFIGURATIONS[:gcs]
  class ActiveStorage::Site::GCSSiteTest < ActiveSupport::TestCase
    SITE = ActiveStorage::Site.configure(:GCS, SITE_CONFIGURATIONS[:gcs])

    include ActiveStorage::Site::SharedSiteTests

    test "signed URL generation" do
      travel_to Time.now do
        url = SITE.bucket.signed_url(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
else
  puts "Skipping GCS Site tests because no GCS configuration was supplied"
end