Skip to content

Commit

Permalink
Fix test regarding to GOVUK_ASSET_ROOT
Browse files Browse the repository at this point in the history
GOVUK_ASSET_ROOT has been specified in govuk-docker since alphagov/govuk-docker@854556a. Thus local environment no longer resolve to default of "https://static.test.gov.uk" and changes the behavior of these tests.
  • Loading branch information
yuetylauiris committed Sep 19, 2023
1 parent 44cefdf commit 636adfb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ def govspeak_to_html(govspeak)
)
presented_item = present(organisation)

expected_image_url = "https://static.test.gov.uk" \
"/government/uploads/system/uploads/organisation/logo/#{organisation.logo.model.id}/960x640_jpeg.jpg"
expected_image_url = "#{Plek.asset_root}/government/uploads/system/uploads/organisation/logo/#{organisation.logo.model.id}/960x640_jpeg.jpg"

assert_equal(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def present(...)
worldwide_organisation: worldwide_org,
attachments: [create(:file_attachment)])
expected_body_text = "<div class=\"govspeak\"><p>Some stuff and some attachments"
expected_body_attachment_link = Regexp.new(/<a class="govuk-link" href="https:\/\/static.test.gov.uk\/government\/uploads\/system\/uploads\/attachment_data\/file\/\d+\/greenpaper.pdf">file-attachment-title-\d+<\/a>/)
expected_body_attachment_link = Regexp.new(/<a class="govuk-link" href="#{Plek.asset_root}\/government\/uploads\/system\/uploads\/attachment_data\/file\/\d+\/greenpaper.pdf">file-attachment-title-\d+<\/a>/)
expected_body_attachment_metadata = "(<span class=\"gem-c-attachment-link__attribute\"><abbr title=\"Portable Document Format\" class=\"gem-c-attachment-link__abbr\">PDF</abbr></span>, <span class=\"gem-c-attachment-link__attribute\">3.39 KB</span>, <span class=\"gem-c-attachment-link__attribute\">1 page</span>)"

presented_item = present(worldwide_org)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 636adfb

Please sign in to comment.