diff --git a/app/models/policies/further_education_payments/claim_checking_tasks.rb b/app/models/policies/further_education_payments/claim_checking_tasks.rb index f6159a4ff5..67471388b5 100644 --- a/app/models/policies/further_education_payments/claim_checking_tasks.rb +++ b/app/models/policies/further_education_payments/claim_checking_tasks.rb @@ -20,7 +20,7 @@ def applicable_task_names tasks << "student_loan_plan" if claim.submitted_without_slc_data? tasks << "payroll_details" if claim.must_manually_validate_bank_details? tasks << "matching_details" if matching_claims.exists? - tasks << "payroll_gender" if claim.payroll_gender_missing? + tasks << "payroll_gender" if claim.payroll_gender_missing? || claim.tasks.exists?(name: "payroll_gender") tasks end diff --git a/app/models/policies/international_relocation_payments/claim_checking_tasks.rb b/app/models/policies/international_relocation_payments/claim_checking_tasks.rb index 61314cfd94..513c0b247e 100644 --- a/app/models/policies/international_relocation_payments/claim_checking_tasks.rb +++ b/app/models/policies/international_relocation_payments/claim_checking_tasks.rb @@ -26,7 +26,7 @@ def applicable_task_names tasks << "teaching_hours" tasks << "payroll_details" if claim.must_manually_validate_bank_details? tasks << "matching_details" if matching_claims.exists? - tasks << "payroll_gender" if claim.payroll_gender_missing? + tasks << "payroll_gender" if claim.payroll_gender_missing? || claim.tasks.exists?(name: "payroll_gender") tasks end diff --git a/spec/features/admin/admin_claim_with_missing_payroll_gender_spec.rb b/spec/features/admin/admin_claim_with_missing_payroll_gender_spec.rb index d5c4c06c50..f3bee0b061 100644 --- a/spec/features/admin/admin_claim_with_missing_payroll_gender_spec.rb +++ b/spec/features/admin/admin_claim_with_missing_payroll_gender_spec.rb @@ -45,4 +45,40 @@ expect(claim.latest_decision).to be_approved expect(claim.latest_decision.created_by).to eq(@signed_in_user) end + + scenario "with a policy where payroll gender is the last task" do + irp_claim = create( + :claim, + :submitted, + policy: Policies::InternationalRelocationPayments, + payroll_gender: :dont_know + ) + + fe_claim = create( + :claim, + :submitted, + policy: Policies::FurtherEducationPayments, + payroll_gender: :dont_know + ) + + visit admin_claim_tasks_path(irp_claim) + + click_on "How is the claimant’s gender recorded for payroll purposes?" + + choose "Male" + + click_on "Save and continue" + + expect(page).to have_content("Claim decision") + + visit admin_claim_tasks_path(fe_claim) + + click_on "How is the claimant’s gender recorded for payroll purposes?" + + choose "Male" + + click_on "Save and continue" + + expect(page).to have_content("Claim decision") + end end