From de0153789bd4d16f392a3ccdbccc0c6e18b18fa9 Mon Sep 17 00:00:00 2001 From: vacabor <166112501+vacabor@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:50:00 +0100 Subject: [PATCH] Spec to cover the unhappy path --- config/locales/en.yml | 1 - .../practitioner/find_reference_spec.rb | 27 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 927da7993e..20cbaf5b50 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1400,7 +1400,6 @@ en: question: Enter your claim reference errors: presence: Enter your claim reference number - impermissible: Enter a valid claim reference number email_address: label: Your email address hint1: We’ll use this to update you with progress on your claim. diff --git a/spec/features/early_years_payment/practitioner/find_reference_spec.rb b/spec/features/early_years_payment/practitioner/find_reference_spec.rb index 0aa49c38b1..fd3c9be9dd 100644 --- a/spec/features/early_years_payment/practitioner/find_reference_spec.rb +++ b/spec/features/early_years_payment/practitioner/find_reference_spec.rb @@ -18,17 +18,13 @@ fill_in "Claim reference number", with: claim.reference click_button "Submit" - expect(page).to have_content "Enter your claim reference" + expect(page).to have_content "This claim reference isn’t correct." end scenario "after multiple attempts should work" do when_early_years_payment_practitioner_journey_configuration_exists visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=user@example.com" - expect(page).to have_content "Enter your claim reference" - fill_in "Claim reference number", with: "foo" - click_button "Submit" - expect(page).to have_content "Enter your claim reference" fill_in "Claim reference number", with: claim.reference click_button "Submit" @@ -41,4 +37,25 @@ click_button "Submit" expect(page).to have_content "Sign in with GOV.UK One Login" end + + scenario "should show ineligibility page when an invalid reference is given" do + when_early_years_payment_practitioner_journey_configuration_exists + + visit "/early-years-payment-practitioner/find-reference?skip_landing_page=true&email=user@example.com" + expect(page).to have_content "Enter your claim reference" + fill_in "Claim reference number", with: "invalid" + click_button "Submit" + + expect(page).to have_content "This claim reference isn’t correct." + click_link "Try again" + + expect(page).to have_content "Enter your claim reference" + fill_in "Claim reference number", with: "also invalid" + click_button "Submit" + + expect(page).to have_content "This claim reference isn’t correct." + click_link "Back" + + expect(page).to have_content "Enter your claim reference" + end end