diff --git a/app/controllers/admin/amendments_controller.rb b/app/controllers/admin/amendments_controller.rb
index 5955dd7985..967a555237 100644
--- a/app/controllers/admin/amendments_controller.rb
+++ b/app/controllers/admin/amendments_controller.rb
@@ -2,7 +2,6 @@ class Admin::AmendmentsController < Admin::BaseAdminController
before_action :load_claim
before_action :ensure_service_operator
before_action :ensure_claim_is_amendable
- before_action :set_claim_summary_view, only: [:index]
def index
end
diff --git a/app/controllers/admin/base_admin_controller.rb b/app/controllers/admin/base_admin_controller.rb
index 5b6846d941..e589014d1c 100644
--- a/app/controllers/admin/base_admin_controller.rb
+++ b/app/controllers/admin/base_admin_controller.rb
@@ -58,10 +58,5 @@ def clear_session
session.delete(:role_codes)
session.delete(:claims_backlink_path)
end
-
- def set_claim_summary_view
- policy_append = @claim.policy.to_s.underscore if @claim.policy.is_a?(Policies::FurtherEducationPayments)
- @claim_summary_view = ["claim_summary", policy_append].compact.join("_")
- end
end
end
diff --git a/app/controllers/admin/claims_controller.rb b/app/controllers/admin/claims_controller.rb
index b42a0c878b..6f26e3cb2a 100644
--- a/app/controllers/admin/claims_controller.rb
+++ b/app/controllers/admin/claims_controller.rb
@@ -62,7 +62,6 @@ def hold
redirect_to admin_claim_notes_path(@claim)
else
@note = Note.new
- set_claim_summary_view
render "admin/notes/index"
end
end
diff --git a/app/controllers/admin/decisions_controller.rb b/app/controllers/admin/decisions_controller.rb
index 8bb37d76f0..e24adfbb14 100644
--- a/app/controllers/admin/decisions_controller.rb
+++ b/app/controllers/admin/decisions_controller.rb
@@ -6,7 +6,6 @@ class Admin::DecisionsController < Admin::BaseAdminController
before_action :reject_decided_claims, unless: -> { qa_decision_task? }
before_action :reject_missing_payroll_gender, only: [:create]
before_action :reject_if_claims_preventing_payment, only: [:create]
- before_action :set_claim_summary_view
def new
@decision = Decision.new
diff --git a/app/controllers/admin/notes_controller.rb b/app/controllers/admin/notes_controller.rb
index c67eb15da3..8efb06a6a4 100644
--- a/app/controllers/admin/notes_controller.rb
+++ b/app/controllers/admin/notes_controller.rb
@@ -2,7 +2,6 @@ module Admin
class NotesController < BaseAdminController
before_action :ensure_service_operator
before_action :load_claim
- before_action :set_claim_summary_view
def index
@note = Note.new
diff --git a/app/controllers/admin/payments_controller.rb b/app/controllers/admin/payments_controller.rb
index 2e68f8ec50..452a39bcf6 100644
--- a/app/controllers/admin/payments_controller.rb
+++ b/app/controllers/admin/payments_controller.rb
@@ -3,7 +3,6 @@ class PaymentsController < BaseAdminController
before_action :ensure_service_operator
before_action :find_payroll_run, except: [:index]
before_action :find_payment, except: [:index]
- before_action :set_claim_summary_view, only: [:index]
def index
@claim = Claim.find(params[:claim_id])
diff --git a/app/controllers/admin/support_tickets_controller.rb b/app/controllers/admin/support_tickets_controller.rb
index 73b0d0e1b0..33ccef43f8 100644
--- a/app/controllers/admin/support_tickets_controller.rb
+++ b/app/controllers/admin/support_tickets_controller.rb
@@ -2,7 +2,6 @@ module Admin
class SupportTicketsController < BaseAdminController
before_action :ensure_service_operator
before_action :load_claim
- before_action :set_claim_summary_view
def create
@support_ticket = @claim.build_support_ticket(support_ticket_params)
diff --git a/app/controllers/admin/tasks_controller.rb b/app/controllers/admin/tasks_controller.rb
index 801a9bf5fd..f98582e2b4 100644
--- a/app/controllers/admin/tasks_controller.rb
+++ b/app/controllers/admin/tasks_controller.rb
@@ -5,7 +5,6 @@ class Admin::TasksController < Admin::BaseAdminController
before_action :load_claim
before_action :ensure_task_has_not_already_been_completed, only: [:create]
before_action :load_matching_claims, only: [:show], if: -> { params[:name] == "matching_details" }
- before_action :set_claim_summary_view
def index
@claim_checking_tasks = ClaimCheckingTasks.new(@claim)
diff --git a/app/helpers/admin/claim_summary_helper.rb b/app/helpers/admin/claim_summary_helper.rb
new file mode 100644
index 0000000000..5f6f3995e2
--- /dev/null
+++ b/app/helpers/admin/claim_summary_helper.rb
@@ -0,0 +1,8 @@
+module Admin
+ module ClaimSummaryHelper
+ def claim_summary_view
+ policy_name_to_append = @claim.policy.to_s.underscore if @claim.policy.is_a?(Policies::FurtherEducationPayments)
+ ["claim_summary", policy_name_to_append].compact.join("_")
+ end
+ end
+end
diff --git a/app/views/admin/amendments/index.html.erb b/app/views/admin/amendments/index.html.erb
index 213bcea8bb..3e04dc69cf 100644
--- a/app/views/admin/amendments/index.html.erb
+++ b/app/views/admin/amendments/index.html.erb
@@ -3,7 +3,7 @@
<%= link_to "Back", claims_backlink_path, class: "govuk-back-link" %>
- <%= render "admin/tasks/#{@claim_summary_view}", claim: @claim, heading: @claim.reference %>
+ <%= render "admin/tasks/#{claim_summary_view}", claim: @claim, heading: @claim.reference %>
diff --git a/app/views/admin/decisions/new.html.erb b/app/views/admin/decisions/new.html.erb
index 61e18646a4..4d381be05b 100644
--- a/app/views/admin/decisions/new.html.erb
+++ b/app/views/admin/decisions/new.html.erb
@@ -4,7 +4,7 @@
<%= render("shared/error_summary", instance: @decision, errored_field_id_overrides: { "result": "decision_result_approved" }) if @decision.errors.any? %>
- <%= render "admin/tasks/#{@claim_summary_view}", claim: @claim, heading: "Claim decision" %>
+ <%= render "admin/tasks/#{claim_summary_view}", claim: @claim, heading: "Claim decision" %>
<%= render("incomplete_tasks", claim: @claim, incomplete_task_names: @claim_checking_tasks.incomplete_task_names) if @claim_checking_tasks.incomplete_task_names.any? %>
diff --git a/app/views/admin/notes/index.html.erb b/app/views/admin/notes/index.html.erb
index 91509e736b..9b66fe6324 100644
--- a/app/views/admin/notes/index.html.erb
+++ b/app/views/admin/notes/index.html.erb
@@ -6,7 +6,7 @@
<%= render("shared/error_summary", instance: @hold_note, errored_field_id_overrides: {body: "hold_body"}) if @hold_note.errors.any? %>
- <%= render "admin/tasks/#{@claim_summary_view}", claim: @claim, heading: @claim.reference %>
+ <%= render "admin/tasks/#{claim_summary_view}", claim: @claim, heading: @claim.reference %>
diff --git a/app/views/admin/payments/index.html.erb b/app/views/admin/payments/index.html.erb
index d5047f0ae5..991cf7f964 100644
--- a/app/views/admin/payments/index.html.erb
+++ b/app/views/admin/payments/index.html.erb
@@ -6,7 +6,7 @@
<%# render("shared/error_summary", instance: @hold_note, errored_field_id_overrides: {body: "hold_body"}) if @hold_note.errors.any? %>
- <%= render "admin/tasks/#{@claim_summary_view}", claim: @claim, heading: @claim.reference %>
+ <%= render "admin/tasks/#{claim_summary_view}", claim: @claim, heading: @claim.reference %>
diff --git a/app/views/admin/tasks/arrival_date.html.erb b/app/views/admin/tasks/arrival_date.html.erb
index e7895719d3..c1cb2e4bb4 100644
--- a/app/views/admin/tasks/arrival_date.html.erb
+++ b/app/views/admin/tasks/arrival_date.html.erb
@@ -3,7 +3,7 @@
<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render @claim_summary_view, claim: @claim, heading: "Arrival date" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Arrival date" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/census_subjects_taught.html.erb b/app/views/admin/tasks/census_subjects_taught.html.erb
index 90b69959f1..ca480bf787 100644
--- a/app/views/admin/tasks/census_subjects_taught.html.erb
+++ b/app/views/admin/tasks/census_subjects_taught.html.erb
@@ -4,7 +4,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "School workforce census subjects taught" %>
+ <%= render claim_summary_view, claim: @claim, heading: "School workforce census subjects taught" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/employment.html.erb b/app/views/admin/tasks/employment.html.erb
index f466b15788..f02d30ea64 100644
--- a/app/views/admin/tasks/employment.html.erb
+++ b/app/views/admin/tasks/employment.html.erb
@@ -4,7 +4,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "Employment" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Employment" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/employment_contract.html.erb b/app/views/admin/tasks/employment_contract.html.erb
index f9d3acff5b..60acfc0e78 100644
--- a/app/views/admin/tasks/employment_contract.html.erb
+++ b/app/views/admin/tasks/employment_contract.html.erb
@@ -3,7 +3,7 @@
<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render @claim_summary_view, claim: @claim, heading: "Employment contract check" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Employment contract check" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/employment_start.html.erb b/app/views/admin/tasks/employment_start.html.erb
index bfc4f7b9b8..ad9b0a6561 100644
--- a/app/views/admin/tasks/employment_start.html.erb
+++ b/app/views/admin/tasks/employment_start.html.erb
@@ -3,7 +3,7 @@
<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render @claim_summary_view, claim: @claim, heading: "Employment start date check" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Employment start date check" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/identity_confirmation.html.erb b/app/views/admin/tasks/identity_confirmation.html.erb
index e5394b84f4..32321f5efb 100644
--- a/app/views/admin/tasks/identity_confirmation.html.erb
+++ b/app/views/admin/tasks/identity_confirmation.html.erb
@@ -4,7 +4,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "Identity confirmation" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Identity confirmation" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/index.html.erb b/app/views/admin/tasks/index.html.erb
index 72fc04bd14..b058e8f2dd 100644
--- a/app/views/admin/tasks/index.html.erb
+++ b/app/views/admin/tasks/index.html.erb
@@ -19,7 +19,7 @@
<% end %>
- <%= render @claim_summary_view, claim: @claim %>
+ <%= render claim_summary_view, claim: @claim %>
diff --git a/app/views/admin/tasks/induction_confirmation.erb b/app/views/admin/tasks/induction_confirmation.erb
index c765d146cc..cb6ea3919a 100644
--- a/app/views/admin/tasks/induction_confirmation.erb
+++ b/app/views/admin/tasks/induction_confirmation.erb
@@ -4,7 +4,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "Induction confirmation" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Induction confirmation" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/matching_details.html.erb b/app/views/admin/tasks/matching_details.html.erb
index e384c8f4ae..7520872221 100644
--- a/app/views/admin/tasks/matching_details.html.erb
+++ b/app/views/admin/tasks/matching_details.html.erb
@@ -4,7 +4,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "Claims with matching details" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Claims with matching details" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/payroll_details.html.erb b/app/views/admin/tasks/payroll_details.html.erb
index 198e56622a..b314a87901 100644
--- a/app/views/admin/tasks/payroll_details.html.erb
+++ b/app/views/admin/tasks/payroll_details.html.erb
@@ -3,7 +3,7 @@
<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render @claim_summary_view, claim: @claim, heading: "Payroll details" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Payroll details" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/payroll_gender.html.erb b/app/views/admin/tasks/payroll_gender.html.erb
index 6a7b86cef0..f6dd4722d8 100644
--- a/app/views/admin/tasks/payroll_gender.html.erb
+++ b/app/views/admin/tasks/payroll_gender.html.erb
@@ -5,7 +5,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "Payroll gender" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Payroll gender" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/qualifications.html.erb b/app/views/admin/tasks/qualifications.html.erb
index 34644e9e64..06005031d6 100644
--- a/app/views/admin/tasks/qualifications.html.erb
+++ b/app/views/admin/tasks/qualifications.html.erb
@@ -4,7 +4,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "Qualifications" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Qualifications" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/student_loan_amount.html.erb b/app/views/admin/tasks/student_loan_amount.html.erb
index 84d68f5b87..ab21f55d4a 100644
--- a/app/views/admin/tasks/student_loan_amount.html.erb
+++ b/app/views/admin/tasks/student_loan_amount.html.erb
@@ -4,7 +4,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "Student loan amount" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Student loan amount" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/student_loan_plan.html.erb b/app/views/admin/tasks/student_loan_plan.html.erb
index 5f38310cef..cc4d1140f6 100644
--- a/app/views/admin/tasks/student_loan_plan.html.erb
+++ b/app/views/admin/tasks/student_loan_plan.html.erb
@@ -4,7 +4,7 @@
- <%= render @claim_summary_view, claim: @claim, heading: "Student loan plan type" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Student loan plan type" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/subject.html.erb b/app/views/admin/tasks/subject.html.erb
index b6d1ea247e..8d823f71dc 100644
--- a/app/views/admin/tasks/subject.html.erb
+++ b/app/views/admin/tasks/subject.html.erb
@@ -3,7 +3,7 @@
<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render @claim_summary_view, claim: @claim, heading: "Subject check" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Subject check" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/teaching_hours.html.erb b/app/views/admin/tasks/teaching_hours.html.erb
index 89f2b57018..543c9d0504 100644
--- a/app/views/admin/tasks/teaching_hours.html.erb
+++ b/app/views/admin/tasks/teaching_hours.html.erb
@@ -3,7 +3,7 @@
<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render @claim_summary_view, claim: @claim, heading: "Subject check" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Subject check" %>
<%= @current_task_name.humanize %>
diff --git a/app/views/admin/tasks/visa.html.erb b/app/views/admin/tasks/visa.html.erb
index 1022fd2937..e4d2b305dd 100644
--- a/app/views/admin/tasks/visa.html.erb
+++ b/app/views/admin/tasks/visa.html.erb
@@ -3,7 +3,7 @@
<%= render "shared/error_summary", instance: @task, errored_field_id_overrides: { "passed": "task_passed_true" } if @task.errors.any? %>
- <%= render @claim_summary_view, claim: @claim, heading: "Visa check" %>
+ <%= render claim_summary_view, claim: @claim, heading: "Visa check" %>
<%= @current_task_name.humanize %>
diff --git a/spec/helpers/admin/claim_summary_helper_spec.rb b/spec/helpers/admin/claim_summary_helper_spec.rb
new file mode 100644
index 0000000000..7cb089b80f
--- /dev/null
+++ b/spec/helpers/admin/claim_summary_helper_spec.rb
@@ -0,0 +1,25 @@
+require "rails_helper"
+
+describe Admin::ClaimsHelper do
+ describe "#claim_summary_view" do
+ subject { helper.claim_summary_view }
+
+ let(:claim) { build(:claim, policy: policy) }
+
+ before { assign(:claim, claim) }
+
+ Policies.all.excluding(Policies::FurtherEducationPayments).each do |policy|
+ context "for policy #{policy}" do
+ let(:policy) { policy }
+
+ it { is_expected.to eq "claim_summary" }
+ end
+ end
+
+ context "for FurtherEducationPayments" do
+ let(:policy) { Policies::FurtherEducationPayments }
+
+ it { is_expected.to eq "claim_summary_further_education_payments" }
+ end
+ end
+end