diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-09 17:04:37 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-07-09 17:04:37 +0200 |
commit | 5bb3f63b318932de0bc21b164d5eb2530a718c3d (patch) | |
tree | 8cb01656571338673198f288ac646dad3ce0466a /test | |
parent | 4bfe7af68f1e1a7d02ace760ac1a5c5a4462edb2 (diff) | |
download | rails-5bb3f63b318932de0bc21b164d5eb2530a718c3d.tar.gz rails-5bb3f63b318932de0bc21b164d5eb2530a718c3d.tar.bz2 rails-5bb3f63b318932de0bc21b164d5eb2530a718c3d.zip |
Test URL generation for S3 and Disk
Diffstat (limited to 'test')
-rw-r--r-- | test/service/disk_service_test.rb | 5 | ||||
-rw-r--r-- | test/service/s3_service_test.rb | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/test/service/disk_service_test.rb b/test/service/disk_service_test.rb index 94df146024..c5404f55e6 100644 --- a/test/service/disk_service_test.rb +++ b/test/service/disk_service_test.rb @@ -5,4 +5,9 @@ class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase SERVICE = ActiveStorage::Service::DiskService.new(root: File.join(Dir.tmpdir, "active_storage")) include ActiveStorage::Service::SharedServiceTests + + test "url generation" do + assert_match /rails\/blobs\/.*\/avatar\.png\?disposition=inline/, + @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "avatar.png") + end end diff --git a/test/service/s3_service_test.rb b/test/service/s3_service_test.rb index e8cc4cb5f4..3e1838e393 100644 --- a/test/service/s3_service_test.rb +++ b/test/service/s3_service_test.rb @@ -5,6 +5,11 @@ if SERVICE_CONFIGURATIONS[:s3] SERVICE = ActiveStorage::Service.configure(:s3, SERVICE_CONFIGURATIONS) include ActiveStorage::Service::SharedServiceTests + + test "signed URL generation" do + assert_match /rails-activestorage\.s3\.amazonaws\.com.*response-content-disposition=inline.*avatar\.png/, + @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "avatar.png") + end end else puts "Skipping S3 Service tests because no S3 configuration was supplied" |