Skip to content

Commit

Permalink
Add provider name and missed titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Kizr committed Dec 24, 2024
1 parent 1733a66 commit b36229b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/controllers/claims/sampling/claims_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/views/claims/sampling/claims/error.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :page_title, t(".page_title") %>

<div class="govuk-width-container">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
2 changes: 2 additions & 0 deletions app/views/claims/sampling/claims/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :page_title, t(".page_title") %>

<div class="govuk-width-container">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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

0 comments on commit b36229b

Please sign in to comment.