mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Test URL generation for S3 and Disk
This commit is contained in:
parent
4bfe7af68f
commit
5bb3f63b31
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue