From 305bf508a4385d0b972afda609968eca942dbbe7 Mon Sep 17 00:00:00 2001 From: Kenneth Lee Date: Wed, 18 Sep 2024 13:02:45 +0100 Subject: [PATCH] Display the note in the task a chaser email was sent --- ...provider_verification_unsubmitted.html.erb | 9 +++- ...n_claim_further_education_payments_spec.rb | 46 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/app/views/admin/tasks/_provider_verification_unsubmitted.html.erb b/app/views/admin/tasks/_provider_verification_unsubmitted.html.erb index 631b40e967..7aa5e64089 100644 --- a/app/views/admin/tasks/_provider_verification_unsubmitted.html.erb +++ b/app/views/admin/tasks/_provider_verification_unsubmitted.html.erb @@ -1,10 +1,15 @@ <% if @tasks_presenter.provider_verification.verification_email_sent? %> <% if @tasks_presenter.provider_verification.verification_email_sent_by_admin_team? %>
- <% @tasks_presenter.provider_verification.admin_sent_emails.each do |verification_email| %> + <% @tasks_presenter.provider_verification.admin_sent_emails.each do |verification_email|%>

The verification request was sent to the provider by - <%= user_details(verification_email.created_by) %> on <%= l(verification_email.created_at) %> + <% if verification_email.created_by %> + <%= user_details(verification_email.created_by) %> + <% else %> + an automated process + <% end %> + on <%= l(verification_email.created_at) %>

<% end %>
diff --git a/spec/features/admin/admin_claim_further_education_payments_spec.rb b/spec/features/admin/admin_claim_further_education_payments_spec.rb index 5e16116146..288b77f5e3 100644 --- a/spec/features/admin/admin_claim_further_education_payments_spec.rb +++ b/spec/features/admin/admin_claim_further_education_payments_spec.rb @@ -236,6 +236,52 @@ expect(claim.eligibility.reload.provider_verification_email_last_sent_at).to eq Time.now end + + it "shows the chaser verification email was sent if one was sent after 3 weeks" do + fe_provider = create( + :school, + :further_education, + :fe_eligible, + name: "Springfield A and M" + ) + + claim = create( + :claim, + first_name: "Edna", + surname: "Krabappel", + date_of_birth: Date.new(1945, 7, 3), + reference: "AB123456", + created_at: DateTime.new(2024, 8, 1, 9, 0, 0), + submitted_at: DateTime.new(2024, 8, 1, 9, 0, 0) + ) + + create( + :further_education_payments_eligibility, + contract_type: "fixed_term", + claim: claim, + school: fe_provider, + award_amount: 1500, + provider_verification_email_last_sent_at: DateTime.new(2024, 8, 1, 9, 0, 0) + ) + + perform_enqueued_jobs do + FurtherEducationPayments::ProviderVerificationChaseEmailJob.perform_now + end + + visit admin_claim_path(claim) + + click_on "View tasks" + + click_on( + "Confirm the provider has responded and verified the claimant's " \ + "information" + ) + + expect(page).to have_content( + "The verification request was sent to the provider by " \ + "an automated process on 9 September 2024 11:00am" + ) + end end end end