From eed6a4f2dc30b099dd0b3501a1f09e35972f501a Mon Sep 17 00:00:00 2001 From: Ben Abraham <16797406+Kizr@users.noreply.github.com> Date: Tue, 24 Dec 2024 11:09:37 +0000 Subject: [PATCH] Add provider name and missed titles --- app/controllers/claims/sampling/claims_controller.rb | 3 ++- app/views/claims/sampling/claims/error.html.erb | 2 ++ app/views/claims/sampling/claims/index.html.erb | 2 ++ ...der_user_downloads_sampling_csv_with_expired_token_spec.rb | 1 + ...r_downloads_sampling_csv_with_invalid_record_token_spec.rb | 1 + ...der_user_downloads_sampling_csv_with_invalid_token_spec.rb | 1 + ...vider_user_downloads_sampling_csv_with_valid_token_spec.rb | 4 +++- 7 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/claims/sampling/claims_controller.rb b/app/controllers/claims/sampling/claims_controller.rb index 73a778fa8..632e75acc 100644 --- a/app/controllers/claims/sampling/claims_controller.rb +++ b/app/controllers/claims/sampling/claims_controller.rb @@ -6,7 +6,8 @@ class Claims::Sampling::ClaimsController < Claims::ApplicationController before_action :set_provider_sampling def download - send_data @provider_sampling.csv_file.download, filename: "sampling-claims-#{Time.current.iso8601}.csv" + provider_name = @provider_sampling.provider_name.parameterize + send_data @provider_sampling.csv_file.download, filename: "sampling-claims-#{provider_name}-#{Time.current.iso8601}.csv" end private diff --git a/app/views/claims/sampling/claims/error.html.erb b/app/views/claims/sampling/claims/error.html.erb index 446d1209f..cd9c324bf 100644 --- a/app/views/claims/sampling/claims/error.html.erb +++ b/app/views/claims/sampling/claims/error.html.erb @@ -1,3 +1,5 @@ +<% content_for :page_title, t(".page_title") %> +
diff --git a/app/views/claims/sampling/claims/index.html.erb b/app/views/claims/sampling/claims/index.html.erb index 6f498b034..f71b4e871 100644 --- a/app/views/claims/sampling/claims/index.html.erb +++ b/app/views/claims/sampling/claims/index.html.erb @@ -1,3 +1,5 @@ +<% content_for :page_title, t(".page_title") %> +
diff --git a/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_expired_token_spec.rb b/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_expired_token_spec.rb index d8e3fa2a7..d01dc3a17 100644 --- a/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_expired_token_spec.rb +++ b/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_expired_token_spec.rb @@ -24,6 +24,7 @@ def when_i_visit_the_download_link_in_the_email end def then_i_see_the_error_page + expect(page).to have_title("Sorry, there is a problem with the download link - Claim funding for mentor training - GOV.UK") expect(page).to have_h1("Sorry, there is a problem with the download link") expect(page).to have_element(:p, text: "You are seeing this page because the download link is not working. It may have timed out or contained an invalid security token.", class: "govuk-body") expect(page).to have_element(:p, text: "Email ittmentor.funding@education.gov.uk to request a new download link.", class: "govuk-body") diff --git a/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_invalid_record_token_spec.rb b/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_invalid_record_token_spec.rb index ae9b32dda..4c1e4b813 100644 --- a/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_invalid_record_token_spec.rb +++ b/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_invalid_record_token_spec.rb @@ -24,6 +24,7 @@ def when_i_visit_the_download_link_in_the_email end def then_i_see_the_error_page + expect(page).to have_title("Sorry, there is a problem with the download link - Claim funding for mentor training - GOV.UK") expect(page).to have_h1("Sorry, there is a problem with the download link") expect(page).to have_element(:p, text: "You are seeing this page because the download link is not working. It may have timed out or contained an invalid security token.", class: "govuk-body") expect(page).to have_element(:p, text: "Email ittmentor.funding@education.gov.uk to request a new download link.", class: "govuk-body") diff --git a/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_invalid_token_spec.rb b/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_invalid_token_spec.rb index 38a34cd1e..ed20edfd9 100644 --- a/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_invalid_token_spec.rb +++ b/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_invalid_token_spec.rb @@ -24,6 +24,7 @@ def when_i_visit_the_download_link_in_the_email end def then_i_see_the_error_page + expect(page).to have_title("Sorry, there is a problem with the download link - Claim funding for mentor training - GOV.UK") expect(page).to have_h1("Sorry, there is a problem with the download link") expect(page).to have_element(:p, text: "You are seeing this page because the download link is not working. It may have timed out or contained an invalid security token.", class: "govuk-body") expect(page).to have_element(:p, text: "Email ittmentor.funding@education.gov.uk to request a new download link.", class: "govuk-body") diff --git a/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_valid_token_spec.rb b/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_valid_token_spec.rb index 6fcc8cc1e..1c09f7398 100644 --- a/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_valid_token_spec.rb +++ b/spec/system/claims/sampling/claims/provider_user_downloads_sampling_csv_with_valid_token_spec.rb @@ -27,6 +27,7 @@ def when_i_visit_the_download_link_in_the_email end def then_i_see_the_download_page + expect(page).to have_title("Download the sampling CSV - Claim funding for mentor training - GOV.UK") expect(page).to have_h1("Download the sampling CSV") expect(page).to have_element(:p, text: "Download the Claim funding for mentor training sampling CSV file.", class: "govuk-body") expect(page).to have_element(:p, text: "If you have any questions, email ittmentor.funding@education.gov.uk", class: "govuk-body") @@ -39,7 +40,8 @@ def when_i_click_on_the_download_button def then_the_csv_is_downloaded current_time = Time.zone.now.utc.strftime("%Y-%m-%dT%H%%3A%M%%3A%SZ") + provider_name = @provider_sampling.provider_name.parameterize expect(page.response_headers["Content-Type"]).to eq("text/csv") - expect(page.response_headers["Content-Disposition"]).to eq("attachment; filename=\"sampling-claims-#{current_time}.csv\"; filename*=UTF-8''sampling-claims-#{current_time}.csv") + expect(page.response_headers["Content-Disposition"]).to eq("attachment; filename=\"sampling-claims-#{provider_name}-#{current_time}.csv\"; filename*=UTF-8''sampling-claims-#{provider_name}-#{current_time}.csv") end end