From 38e72317fe0d5ff695a048e67180394b282b7bc4 Mon Sep 17 00:00:00 2001 From: Kevin Dew Date: Mon, 22 Jun 2020 15:09:53 +0100 Subject: [PATCH] Use Plek#asset_root over Plek#public_asset_host I'm removing this as part of a plan to remove Plek#public_asset_host and the associated GOVUK_ASSET_HOST env var. The reason to remove these is because they are the same #asset_root and GOVUK_ASSET_ROOT, which pushes developers to consider which one to use when they both have the same effect. Government frontend appears to be the only app other than Whitehall that has used this method, which I assume is because the code it is used in was ported from Whitehall. --- app/controllers/asset_manager_redirect_controller.rb | 2 +- test/controllers/asset_manager_redirect_controller_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/asset_manager_redirect_controller.rb b/app/controllers/asset_manager_redirect_controller.rb index 7bba68370..fc877b585 100644 --- a/app/controllers/asset_manager_redirect_controller.rb +++ b/app/controllers/asset_manager_redirect_controller.rb @@ -1,6 +1,6 @@ class AssetManagerRedirectController < ApplicationController def show - asset_url = Plek.new.public_asset_host + asset_url = Plek.new.asset_root if request.host.start_with?("draft-") asset_url = Plek.new.external_url_for("draft-assets") end diff --git a/test/controllers/asset_manager_redirect_controller_test.rb b/test/controllers/asset_manager_redirect_controller_test.rb index b32bc2867..a013a984a 100644 --- a/test/controllers/asset_manager_redirect_controller_test.rb +++ b/test/controllers/asset_manager_redirect_controller_test.rb @@ -2,7 +2,7 @@ class AssetManagerRedirectControllerTest < ActionController::TestCase setup do - Plek.any_instance.stubs(:public_asset_host).returns("http://asset-host.com") + Plek.any_instance.stubs(:asset_root).returns("http://asset-host.com") Plek.any_instance.stubs(:external_url_for).returns("http://draft-asset-host.com") end