From e4f8b1002c3b8dcdd95019b8bc6314c73f30aa2f Mon Sep 17 00:00:00 2001 From: Alkesh Vaghmaria Date: Thu, 5 Sep 2024 16:20:38 +0100 Subject: [PATCH] feature spec --- .../eligibilities.rb | 4 ++ ...w_claim_further_education_payments_spec.rb | 44 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 spec/features/admin/admin_view_claim_further_education_payments_spec.rb diff --git a/spec/factories/policies/further_education_payments/eligibilities.rb b/spec/factories/policies/further_education_payments/eligibilities.rb index e663709ee4..c3ad58ca46 100644 --- a/spec/factories/policies/further_education_payments/eligibilities.rb +++ b/spec/factories/policies/further_education_payments/eligibilities.rb @@ -122,5 +122,9 @@ } end end + + trait :with_trn do + teacher_reference_number { generate(:teacher_reference_number) } + end end end diff --git a/spec/features/admin/admin_view_claim_further_education_payments_spec.rb b/spec/features/admin/admin_view_claim_further_education_payments_spec.rb new file mode 100644 index 0000000000..7b148db727 --- /dev/null +++ b/spec/features/admin/admin_view_claim_further_education_payments_spec.rb @@ -0,0 +1,44 @@ +require "rails_helper" + +RSpec.feature "Admin view claim for FurtherEducationPayments" do + let!(:journey_configuration) { create(:journey_configuration, "further_education_payments") } + let(:eligibility) { create(:further_education_payments_eligibility, :eligible) } + let(:eligibility_with_trn) { create(:further_education_payments_eligibility, :eligible, :with_trn) } + let!(:claim) { + create( + :claim, + :submitted, + policy: Policies::FurtherEducationPayments, + eligibility: eligibility + ) + } + let!(:claim_with_trn) { + create( + :claim, + :submitted, + policy: Policies::FurtherEducationPayments, + eligibility: eligibility_with_trn + ) + } + + scenario "view claim summary for claim with no TRN" do + sign_in_as_service_operator + visit admin_claims_path + find("a[href='#{admin_claim_tasks_path(claim)}']").click + expect(page).not_to have_content("Claim route") + expect(page).not_to have_content("Not signed in with DfE Identity") + expect(page).to have_content("Not provided") + expect(page).to have_content("UK Provider Reference Number (UKPRN)") + expect(page).to have_content(claim.school.ukprn) + end + + scenario "view claim summary for claim with TRN" do + sign_in_as_service_operator + visit admin_claims_path + find("a[href='#{admin_claim_tasks_path(claim_with_trn)}']").click + expect(page).not_to have_content("Not provided") + expect(page).to have_content(claim_with_trn.eligibility.teacher_reference_number) + expect(page).to have_content("UK Provider Reference Number (UKPRN)") + expect(page).to have_content(claim_with_trn.school.ukprn) + end +end