From 8b3bf484ead91ffbe2367f3eeb05c6ea2e931be8 Mon Sep 17 00:00:00 2001 From: Alkesh Vaghmaria Date: Tue, 24 Sep 2024 17:01:03 +0100 Subject: [PATCH] remove radio buttons from Student Loan Plan task --- app/helpers/admin/claims_helper.rb | 5 +- .../admin/tasks/student_loan_plan.html.erb | 11 +++- config/locales/en.yml | 2 - .../eligibilities.rb | 6 ++ ...s_further_education_payments_claim_spec.rb | 5 ++ .../admin/admin_claims_filtering_spec.rb | 8 +-- .../provider_verification_chase_email_spec.rb | 6 +- .../claim_verifiers/student_loan_plan_spec.rb | 16 ++--- spec/models/claim_spec.rb | 2 +- .../admin_checks_feature_shared_examples.rb | 66 +++++++++++++++---- 10 files changed, 95 insertions(+), 32 deletions(-) create mode 100644 spec/features/admin/admin_checks_further_education_payments_claim_spec.rb diff --git a/app/helpers/admin/claims_helper.rb b/app/helpers/admin/claims_helper.rb index d01366f027..55a8158b78 100644 --- a/app/helpers/admin/claims_helper.rb +++ b/app/helpers/admin/claims_helper.rb @@ -171,8 +171,11 @@ def task_status_tag(claim, task_name) status_colour = "red" end - tag_classes = "govuk-tag app-task-list__task-completed govuk-tag--#{status_colour}" + task_status_content_tag(status_colour:, status:) + end + def task_status_content_tag(status_colour:, status:) + tag_classes = "govuk-tag app-task-list__task-completed govuk-tag--#{status_colour}" content_tag("strong", status, class: tag_classes) end diff --git a/app/views/admin/tasks/student_loan_plan.html.erb b/app/views/admin/tasks/student_loan_plan.html.erb index 5b659ff4a9..1f1dda4440 100644 --- a/app/views/admin/tasks/student_loan_plan.html.erb +++ b/app/views/admin/tasks/student_loan_plan.html.erb @@ -15,10 +15,17 @@
- <% if !@task.passed.nil? %> + <% if @task.persisted? %> <%= render "task_outcome", task: @task %> <% else %> - <%= render "form", task_name: "student_loan_plan", claim: @claim %> +
+

+ <%= task_status_content_tag(status_colour: "grey", status: "Incomplete") %> +

+

+ This task has not been checked against Student Loan Company data yet. +

+
<% end %> <%= render partial: "admin/task_pagination" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 4ebdac63b8..5a8d76eba8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -933,8 +933,6 @@ en: claimant_answers: true: "Yes" false: "No" - student_loan_plan: - title: "Does the claimant’s student loan plan match the information we hold about their loan?" forms: ineligible: courses: diff --git a/spec/factories/policies/further_education_payments/eligibilities.rb b/spec/factories/policies/further_education_payments/eligibilities.rb index 2775a82d95..868766b622 100644 --- a/spec/factories/policies/further_education_payments/eligibilities.rb +++ b/spec/factories/policies/further_education_payments/eligibilities.rb @@ -6,6 +6,12 @@ trait :eligible do eligible_school contract_type { "permanent" } + verified + end + + trait :not_verified do + eligible_school + contract_type { "permanent" } end trait :eligible_school do diff --git a/spec/features/admin/admin_checks_further_education_payments_claim_spec.rb b/spec/features/admin/admin_checks_further_education_payments_claim_spec.rb new file mode 100644 index 0000000000..5a5f01983a --- /dev/null +++ b/spec/features/admin/admin_checks_further_education_payments_claim_spec.rb @@ -0,0 +1,5 @@ +require "rails_helper" + +RSpec.feature "Admin checks an Further Education Payments claim" do + it_behaves_like "Admin Checks", Policies::FurtherEducationPayments +end diff --git a/spec/features/admin/admin_claims_filtering_spec.rb b/spec/features/admin/admin_claims_filtering_spec.rb index 1efc8f778b..d6018c972d 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 @@ -74,8 +74,8 @@ scenario "the service operator can filter by themselves or other team members" do click_on "View claims" - expect(page.find("table")).to have_content("TSLR").exactly(5).times - expect(page.find("table")).to have_content("ECP").exactly(10).times + expect(page).to have_selector("td[text()='TSLR']", count: 5) + expect(page).to have_selector("td[text()='ECP']", count: 10) # Excludes payroll users and deleted users expect(page).to have_select("team_member", options: ["All", "Unassigned", "#{user.given_name} #{user.family_name}", "Mary Wasu Wabi", "Valentino Ricci", "Mette Jørgensen"]) @@ -109,7 +109,7 @@ select "Unassigned", from: "team_member" click_on "Apply filters" - expect(page.find("table")).to have_content("STRI").exactly(2).times + expect(page).to have_selector("td[text()='STRI']", count: 2) expect_page_to_show_claims(lup_claims_unassigned) end 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..d0726c1fc2 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) )) } diff --git a/spec/models/automated_checks/claim_verifiers/student_loan_plan_spec.rb b/spec/models/automated_checks/claim_verifiers/student_loan_plan_spec.rb index 94188cb9e8..1849073be0 100644 --- a/spec/models/automated_checks/claim_verifiers/student_loan_plan_spec.rb +++ b/spec/models/automated_checks/claim_verifiers/student_loan_plan_spec.rb @@ -10,7 +10,7 @@ module ClaimVerifiers let(:claim_arg) { claim } let(:claim) { create(:claim, :submitted, policy:) } - shared_examples :execution_with_an_outcome do + shared_examples :creating_a_task_and_note do let(:saved_task) { claim_arg.tasks.find_by(name: "student_loan_plan") } let(:saved_note) { claim_arg.notes.last } @@ -49,7 +49,7 @@ module ClaimVerifiers end end - shared_examples :execution_without_an_outcome do + shared_examples :not_creating_a_task_or_note do it "does not save anything and returns immediately", :aggregate_failures do is_expected.to be_nil @@ -64,7 +64,7 @@ module ClaimVerifiers context "when the claim policy is TSLR" do let(:policy) { Policies::StudentLoans } - it_behaves_like :execution_without_an_outcome + it_behaves_like :not_creating_a_task_or_note end context "when the claim policy is ECP/LUP/FE" do @@ -79,14 +79,14 @@ module ClaimVerifiers let(:submitted_using_slc_data) { false } - it_behaves_like :execution_without_an_outcome + it_behaves_like :not_creating_a_task_or_note end context "when the claim was submitted using SLC data" do let(:submitted_using_slc_data) { true } let(:claim_student_loan_plan) { StudentLoan::PLAN_1 } - it_behaves_like :execution_without_an_outcome + it_behaves_like :not_creating_a_task_or_note end context "when the claim was not submitted using SLC data" do @@ -97,7 +97,7 @@ module ClaimVerifiers let(:expected_match_value) { nil } let(:expected_note) { "[SLC Student loan plan] - No data" } - it_behaves_like :execution_with_an_outcome + it_behaves_like :creating_a_task_and_note end context "when there is student loan data - with a plan" do @@ -109,7 +109,7 @@ module ClaimVerifiers let(:expected_match_value) { "all" } let(:expected_note) { "[SLC Student loan plan] - Matched - has a student loan" } - it_behaves_like :execution_with_an_outcome + it_behaves_like :creating_a_task_and_note end context "when there is student loan data - without a plan" do @@ -121,7 +121,7 @@ module ClaimVerifiers let(:expected_match_value) { "all" } let(:expected_note) { "[SLC Student loan plan] - Matched - does not have a student loan" } - it_behaves_like :execution_with_an_outcome + it_behaves_like :creating_a_task_and_note end end end diff --git a/spec/models/claim_spec.rb b/spec/models/claim_spec.rb index 5c56c2a7dc..b028feb62c 100644 --- a/spec/models/claim_spec.rb +++ b/spec/models/claim_spec.rb @@ -910,7 +910,7 @@ subject { described_class.awaiting_further_education_provider_verification } let!(:claim_with_fe_provider_verification) { create(:claim, policy: Policies::FurtherEducationPayments, eligibility_trait: :verified) } - let!(:claim_awaiting_fe_provider_verification) { create(:claim, policy: Policies::FurtherEducationPayments, eligibility_trait: :eligible) } + let!(:claim_awaiting_fe_provider_verification) { create(:claim, policy: Policies::FurtherEducationPayments, eligibility_trait: :not_verified) } let!(:non_fe_claim) { create(:claim, policy: Policies::StudentLoans) } it "returns claims that are awaiting FE provider verification" do diff --git a/spec/support/admin_checks_feature_shared_examples.rb b/spec/support/admin_checks_feature_shared_examples.rb index 38a3aaa522..4fd75536a5 100644 --- a/spec/support/admin_checks_feature_shared_examples.rb +++ b/spec/support/admin_checks_feature_shared_examples.rb @@ -15,6 +15,7 @@ before do @signed_in_user = sign_in_as_service_operator + create(:task, :automated, :passed, name: "student_loan_plan", claim:) end def lup_claim_checking_steps @@ -66,15 +67,13 @@ def lup_claim_checking_steps expect(claim.tasks.find_by!(name: "employment").passed?).to eq(true) - expect(page).to have_content(I18n.t("#{claim.policy.to_s.underscore}.admin.task_questions.student_loan_plan.title")) expect(page).to have_content("Student loan plan") expect(page).to have_link("Next: Decision") expect(page).to have_link("Previous: Employment") + expect(page).to have_content("Passed") + expect(page).not_to have_button("Save and continue") - choose "Yes" - click_on "Save and continue" - - expect(claim.tasks.find_by!(name: "student_loan_plan").passed?).to eq(true) + click_link "Next: Decision" expect(page).to have_content("Claim decision") expect(page).not_to have_link("Next") @@ -149,15 +148,13 @@ def ecp_claim_checking_steps expect(claim.tasks.find_by!(name: "employment").passed?).to eq(true) - expect(page).to have_content(I18n.t("#{claim.policy.to_s.underscore}.admin.task_questions.student_loan_plan.title")) expect(page).to have_content("Student loan plan") expect(page).to have_link("Next: Decision") expect(page).to have_link("Previous: Employment") + expect(page).to have_content("Passed") + expect(page).not_to have_button("Save and continue") - choose "Yes" - click_on "Save and continue" - - expect(claim.tasks.find_by!(name: "student_loan_plan").passed?).to eq(true) + click_link "Next: Decision" expect(page).to have_content("Claim decision") expect(page).not_to have_link("Next") @@ -243,6 +240,51 @@ def tslr_claim_checking_steps expect(claim.latest_decision.created_by).to eq(@signed_in_user) end + def fe_claim_checking_steps + visit admin_claims_path + find("a[href='#{admin_claim_tasks_path(claim)}']").click + + click_on I18n.t("admin.tasks.identity_confirmation.title") + + expect(page).to have_content(I18n.t("#{claim.policy.to_s.underscore}.admin.task_questions.identity_confirmation.title")) + expect(page).to have_link("Next: Provider verification") + expect(page).not_to have_link("Previous") + + choose "Yes" + click_on "Save and continue" + + expect(claim.tasks.find_by!(name: "identity_confirmation").passed?).to eq(true) + + expect(page).to have_content(I18n.t("#{claim.policy.to_s.underscore}.admin.task_questions.provider_verification.title")) + expect(page).to have_link("Next: Student loan plan") + expect(page).to have_link("Previous: Identity confirmation") + + choose "Yes" + click_on "Save and continue" + + expect(claim.tasks.find_by!(name: "provider_verification").passed?).to eq(true) + + expect(page).to have_content("Student loan plan") + expect(page).to have_content("Passed") + expect(page).not_to have_button("Save and continue") + expect(page).to have_link("Next: Decision") + expect(page).to have_link("Previous: Provider verification") + + click_link "Next: Decision" + + expect(page).to have_content("Claim decision") + expect(page).not_to have_link("Next") + expect(page).to have_link("Previous: Student loan plan") + + choose "Approve" + fill_in "Decision notes", with: "All checks passed!" + click_on "Confirm decision" + + expect(page).to have_content("Claim has been approved successfully") + expect(claim.latest_decision).to be_approved + expect(claim.latest_decision.created_by).to eq(@signed_in_user) + end + def qa_approval_steps expect(page).to have_content("This claim has been marked for a quality assurance review") expect(page).to have_content("Quality assurance decision") @@ -269,6 +311,8 @@ def claim_checking_steps(policy) ecp_claim_checking_steps elsif policy == Policies::StudentLoans tslr_claim_checking_steps + elsif policy == Policies::FurtherEducationPayments + fe_claim_checking_steps else raise "Unimplemented policy: #{policy}" end @@ -281,7 +325,7 @@ def claim_checking_steps(policy) claim_checking_steps(policy) end - scenario "service operator QAs a #{policy_name} claim" do + scenario "service operator QAs a #{policy_name} claim", if: policy::MIN_QA_THRESHOLD.positive? do claim_checking_steps(policy) qa_approval_steps end