diff --git a/spec/factories/policies/further_education_payments/eligibilities.rb b/spec/factories/policies/further_education_payments/eligibilities.rb index 189a0184e3..8ccd7c472b 100644 --- a/spec/factories/policies/further_education_payments/eligibilities.rb +++ b/spec/factories/policies/further_education_payments/eligibilities.rb @@ -6,13 +6,19 @@ trait :eligible do eligible_school contract_type { "permanent" } + verified + end + + trait :not_verified do + eligible_school + contract_type { "permanent" } end trait :eligible_school do association :school, factory: :fe_eligible_school end - trait :eligible_duplicate do + trait :duplicate do flagged_as_duplicate { true } end diff --git a/spec/features/admin/admin_claims_filtering_spec.rb b/spec/features/admin/admin_claims_filtering_spec.rb index 1efc8f778b..b69cbf0aef 100644 --- a/spec/features/admin/admin_claims_filtering_spec.rb +++ b/spec/features/admin/admin_claims_filtering_spec.rb @@ -22,7 +22,7 @@ let(:approved_awaiting_qa_claims) { create_list(:claim, 2, :approved, :flagged_for_qa, policy: Policies::LevellingUpPremiumPayments) } let(:auto_approved_awaiting_payroll_claims) { create_list(:claim, 2, :auto_approved, policy: Policies::LevellingUpPremiumPayments) } let(:approved_claim) { create(:claim, :approved, policy: Policies::LevellingUpPremiumPayments, assigned_to: mette, decision_creator: mary) } - let(:further_education_claims_awaiting_provider_verification) { create_list(:claim, 2, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible, assigned_to: valentino) } + let(:further_education_claims_awaiting_provider_verification) { create_list(:claim, 2, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :not_verified, assigned_to: valentino) } let(:rejected_claim) { create(:claim, :rejected, policy: Policies::LevellingUpPremiumPayments, assigned_to: valentino) } let!(:claims) do 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 index 02c1b025fe..ebdd989e7b 100644 --- a/spec/features/admin/admin_view_claim_further_education_payments_spec.rb +++ b/spec/features/admin/admin_view_claim_further_education_payments_spec.rb @@ -8,7 +8,7 @@ :claim, :submitted, policy: Policies::FurtherEducationPayments, - eligibility_trait: :eligible + eligibility_trait: :not_verified ) } let!(:claim_with_trn) { @@ -24,7 +24,7 @@ :claim, :submitted, policy: Policies::FurtherEducationPayments, - eligibility_trait: :eligible_duplicate + eligibility_trait: :duplicate ) } let!(:claim_with_duplicates_provider_email_sent) { @@ -32,7 +32,7 @@ :claim, :submitted, policy: Policies::FurtherEducationPayments, - eligibility_trait: :eligible_duplicate + eligibility_trait: :duplicate ) } let!(:verified_claim) { diff --git a/spec/jobs/further_education_payments/provider_verification_chase_email_spec.rb b/spec/jobs/further_education_payments/provider_verification_chase_email_spec.rb index 1e6d580952..6dd8d09d65 100644 --- a/spec/jobs/further_education_payments/provider_verification_chase_email_spec.rb +++ b/spec/jobs/further_education_payments/provider_verification_chase_email_spec.rb @@ -14,7 +14,7 @@ policy: Policies::FurtherEducationPayments, eligibility: build( :further_education_payments_eligibility, - :eligible + :not_verified )) } @@ -24,7 +24,7 @@ policy: Policies::FurtherEducationPayments, eligibility: build( :further_education_payments_eligibility, - :eligible, + :not_verified, provider_verification_email_last_sent_at: DateTime.new(2024, 10, 1, 7, 0, 0) )) } @@ -35,7 +35,7 @@ policy: Policies::FurtherEducationPayments, eligibility: build( :further_education_payments_eligibility, - :eligible, + :not_verified, provider_verification_email_last_sent_at: DateTime.new(2024, 10, 15, 7, 0, 0) )) } @@ -47,7 +47,6 @@ eligibility: build( :further_education_payments_eligibility, :eligible, - :verified, provider_verification_email_last_sent_at: DateTime.new(2024, 10, 1, 7, 0, 0) )) } @@ -59,7 +58,6 @@ eligibility: build( :further_education_payments_eligibility, :eligible, - :verified, provider_verification_email_last_sent_at: DateTime.new(2024, 9, 1, 8, 0, 0), provider_verification_chase_email_last_sent_at: DateTime.new(2024, 9, 22, 8, 0, 0) )) @@ -83,7 +81,7 @@ policy: Policies::FurtherEducationPayments, eligibility: build( :further_education_payments_eligibility, - :eligible, + :not_verified, provider_verification_email_last_sent_at: DateTime.new(2024, 10, 1, 7, 0, 0) )) } diff --git a/spec/models/claim_spec.rb b/spec/models/claim_spec.rb index bc2bee8ebe..235ccdff5e 100644 --- a/spec/models/claim_spec.rb +++ b/spec/models/claim_spec.rb @@ -909,10 +909,10 @@ describe ".awaiting_further_education_provider_verification" do subject { described_class.awaiting_further_education_provider_verification } - let!(:claim_not_verified_provider_email_automatically_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible) } - let!(:claim_not_verified_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible_duplicate) } - let!(:claim_not_verified_has_duplicates_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible_duplicate) } - let!(:claim_not_verified_has_duplicates_provider_email_manually_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible_duplicate) } + let!(:claim_not_verified_provider_email_automatically_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :not_verified) } + let!(:claim_not_verified_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) } + let!(:claim_not_verified_has_duplicates_provider_email_not_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) } + let!(:claim_not_verified_has_duplicates_provider_email_manually_sent) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) } let!(:claim_with_fe_provider_verification) { create(:claim, policy: Policies::FurtherEducationPayments, eligibility_trait: :verified) } let!(:non_fe_claim) { create(:claim, policy: Policies::StudentLoans) } @@ -921,7 +921,7 @@ create(:note, claim: claim_not_verified_provider_email_not_sent, label: "student_loan_plan") end - it "returns claims that have not been verified by the provider, and have no matching_details task or have a passed matching_details task" do + it "returns claims that have not been verified by the provider, and have had a provider email sent" do is_expected.to match_array([claim_not_verified_provider_email_automatically_sent, claim_not_verified_has_duplicates_provider_email_manually_sent]) end end @@ -1344,13 +1344,13 @@ context "when the eligiblity is not verified" do context "when there are no duplicates" do - let(:claim) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible) } + let(:claim) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :not_verified) } it { is_expected.to be true } end context "when there are duplicates" do - let(:claim) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible_duplicate) } + let(:claim) { create(:claim, :submitted, policy: Policies::FurtherEducationPayments, eligibility_trait: :duplicate) } context "the provider email has not been sent" do it { is_expected.to be false } diff --git a/spec/support/admin_view_claim_feature_shared_examples.rb b/spec/support/admin_view_claim_feature_shared_examples.rb index e467eb801a..7fa8597d41 100644 --- a/spec/support/admin_view_claim_feature_shared_examples.rb +++ b/spec/support/admin_view_claim_feature_shared_examples.rb @@ -42,11 +42,7 @@ } let!(:approved_awaiting_payroll_claim) { - eligibility = if policy == Policies::FurtherEducationPayments - create(:"#{policy.to_s.underscore}_eligibility", :verified) - else - create(:"#{policy.to_s.underscore}_eligibility", :eligible) - end + eligibility = create(:"#{policy.to_s.underscore}_eligibility", :eligible) create( :claim, :payrollable,