From 9436c22e2aa9419f275186967a1b863bc3d01ecb Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 26 Mar 2018 14:36:39 +0100 Subject: Use a current model to provide the host for service urls Trying to pass the current request down to the service so that it can create full urls instead of paths makes the API messy so use a model based on ActiveSupport::CurrentAttributes to provide the current host to services that need it (primarily the disk service). --- activestorage/test/service/disk_service_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activestorage/test/service') diff --git a/activestorage/test/service/disk_service_test.rb b/activestorage/test/service/disk_service_test.rb index 4a6361b920..d7142de458 100644 --- a/activestorage/test/service/disk_service_test.rb +++ b/activestorage/test/service/disk_service_test.rb @@ -8,7 +8,7 @@ class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase include ActiveStorage::Service::SharedServiceTests test "url generation" do - assert_match(/rails\/active_storage\/disk\/.*\/avatar\.png\?content_type=image%2Fpng&disposition=inline/, + assert_match(/^https:\/\/example.com\/rails\/active_storage\/disk\/.*\/avatar\.png\?content_type=image%2Fpng&disposition=inline/, @service.url(FIXTURE_KEY, expires_in: 5.minutes, disposition: :inline, filename: ActiveStorage::Filename.new("avatar.png"), content_type: "image/png")) end end -- cgit v1.2.3