1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix tests

This commit is contained in:
George Claghorn 2017-08-20 18:45:39 -04:00
parent e9468e3971
commit 332049d116
4 changed files with 4 additions and 4 deletions

View file

@ -11,7 +11,7 @@ if SERVICE_CONFIGURATIONS[:azure]
test "signed URL generation" do test "signed URL generation" do
url = @service.url(FIXTURE_KEY, expires_in: 5.minutes, url = @service.url(FIXTURE_KEY, expires_in: 5.minutes,
disposition: :inline, filename: "avatar.png", content_type: "image/png") disposition: "inline; filename=\"avatar.png\"", filename: "avatar.png", content_type: "image/png")
assert_match(/(\S+)&rsct=image%2Fpng&rscd=inline%3B\+filename%3D%22avatar.png/, url) assert_match(/(\S+)&rsct=image%2Fpng&rscd=inline%3B\+filename%3D%22avatar.png/, url)
assert_match SERVICE_CONFIGURATIONS[:azure][:container], url assert_match SERVICE_CONFIGURATIONS[:azure][:container], url

View file

@ -9,6 +9,6 @@ class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
test "url generation" do test "url generation" do
assert_match(/rails\/active_storage\/disk\/.*\/avatar\.png\?.+disposition=inline/, assert_match(/rails\/active_storage\/disk\/.*\/avatar\.png\?.+disposition=inline/,
@service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: "avatar.png", content_type: "image/png")) @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: "inline; filename=\"avatar.png\"", filename: "avatar.png", content_type: "image/png"))
end end
end end

View file

@ -37,7 +37,7 @@ if SERVICE_CONFIGURATIONS[:gcs]
"&response-content-disposition=inline%3B+filename%3D%22test.txt%22" + "&response-content-disposition=inline%3B+filename%3D%22test.txt%22" +
"&response-content-type=text%2Fplain" "&response-content-type=text%2Fplain"
assert_equal url, @service.url(FIXTURE_KEY, expires_in: 2.minutes, disposition: :inline, filename: "test.txt", content_type: "text/plain") assert_equal url, @service.url(FIXTURE_KEY, expires_in: 2.minutes, disposition: "inline; filename=\"test.txt\"", filename: "test.txt", content_type: "text/plain")
end end
end end
end end

View file

@ -33,7 +33,7 @@ if SERVICE_CONFIGURATIONS[:s3] && SERVICE_CONFIGURATIONS[:s3][:access_key_id].pr
test "signed URL generation" do test "signed URL generation" do
url = @service.url(FIXTURE_KEY, expires_in: 5.minutes, url = @service.url(FIXTURE_KEY, expires_in: 5.minutes,
disposition: :inline, filename: "avatar.png", content_type: "image/png") disposition: "inline; filename=\"avatar.png\"", filename: "avatar.png", content_type: "image/png")
assert_match(/s3\.(\S+)?amazonaws.com.*response-content-disposition=inline.*avatar\.png.*response-content-type=image%2Fpng/, url) assert_match(/s3\.(\S+)?amazonaws.com.*response-content-disposition=inline.*avatar\.png.*response-content-type=image%2Fpng/, url)
assert_match SERVICE_CONFIGURATIONS[:s3][:bucket], url assert_match SERVICE_CONFIGURATIONS[:s3][:bucket], url