From 95a5b4388cb163c98a380055f8a0d8f960498fe2 Mon Sep 17 00:00:00 2001 From: Iris Lau Date: Fri, 15 Sep 2023 11:00:23 +0100 Subject: [PATCH] Fix test regarding to GOVUK_ASSET_ROOT GOVUK_ASSET_ROOT has been specified in govuk-docker since https://github.com/alphagov/govuk-docker/commit/854556a399001fe53f72983099d1d26894b27062. Thus local environment no longer resolve to default of "https://static.test.gov.uk" and changes the behavior of these tests. --- .../presenters/publishing_api/organisation_presenter_test.rb | 2 +- .../publishing_api/worldwide_organisation_presenter_test.rb | 2 +- .../migrate_consultation_to_call_for_evidence_test.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/app/presenters/publishing_api/organisation_presenter_test.rb b/test/unit/app/presenters/publishing_api/organisation_presenter_test.rb index 9cb2765a4205..5436ab37bd54 100644 --- a/test/unit/app/presenters/publishing_api/organisation_presenter_test.rb +++ b/test/unit/app/presenters/publishing_api/organisation_presenter_test.rb @@ -136,7 +136,7 @@ def govspeak_to_html(govspeak) ) presented_item = present(organisation) - expected_image_url = "https://static.test.gov.uk" \ + expected_image_url = Plek.asset_root \ "/government/uploads/system/uploads/organisation/logo/#{organisation.logo.model.id}/960x640_jpeg.jpg" assert_equal( diff --git a/test/unit/app/presenters/publishing_api/worldwide_organisation_presenter_test.rb b/test/unit/app/presenters/publishing_api/worldwide_organisation_presenter_test.rb index 6d77f89f234e..4962c71e435d 100644 --- a/test/unit/app/presenters/publishing_api/worldwide_organisation_presenter_test.rb +++ b/test/unit/app/presenters/publishing_api/worldwide_organisation_presenter_test.rb @@ -124,7 +124,7 @@ def present(...) worldwide_organisation: worldwide_org, attachments: [create(:file_attachment)]) expected_body_text = "

Some stuff and some attachments" - expected_body_attachment_link = Regexp.new(/file-attachment-title-\d+<\/a>/) + expected_body_attachment_link = Regexp.new(/file-attachment-title-\d+<\/a>/) expected_body_attachment_metadata = "(PDF, 3.39 KB, 1 page)" presented_item = present(worldwide_org) diff --git a/test/unit/lib/data_hygiene/migrate_consultation_to_call_for_evidence_test.rb b/test/unit/lib/data_hygiene/migrate_consultation_to_call_for_evidence_test.rb index 8ebb0d2d0acf..3dfad17a06fc 100644 --- a/test/unit/lib/data_hygiene/migrate_consultation_to_call_for_evidence_test.rb +++ b/test/unit/lib/data_hygiene/migrate_consultation_to_call_for_evidence_test.rb @@ -60,7 +60,7 @@ def stub_asset_downloads # Stub requests for asset files # and respond with the requested fixture file - urls_starting = "https://static.test.gov.uk/government/uploads/system/uploads/" + urls_starting = "#{Plek.asset_root}/government/uploads/system/uploads/" stub_request(:get, %r{^#{Regexp.escape(urls_starting)}}) .to_return do |request| fixture_name = request.uri.to_s.split("/").last