diff --git a/app/models/policies/early_years_payments/admin_tasks_presenter.rb b/app/models/policies/early_years_payments/admin_tasks_presenter.rb index be259ec421..4ec0887a98 100644 --- a/app/models/policies/early_years_payments/admin_tasks_presenter.rb +++ b/app/models/policies/early_years_payments/admin_tasks_presenter.rb @@ -11,7 +11,7 @@ def initialize(claim) def employment [ - ["Current employment", claim.eligibility.eligible_ey_provider.nursery_name], + ["Current employment", nursery_name], ["Start date", l(claim.eligibility.start_date)] ] end @@ -41,6 +41,19 @@ def student_loan_plan ["Student loan plan", claim.student_loan_plan&.humanize] ] end + + private + + def eligible_ey_provider + claim.eligibility.eligible_ey_provider + end + + def nursery_name + [ + eligible_ey_provider.nursery_name, + "(#{eligible_ey_provider.urn})" + ].join(" ") + end end end end diff --git a/spec/models/policies/early_years_payments/admin_tasks_presenter_spec.rb b/spec/models/policies/early_years_payments/admin_tasks_presenter_spec.rb index 1e37d46268..3cf5a39606 100644 --- a/spec/models/policies/early_years_payments/admin_tasks_presenter_spec.rb +++ b/spec/models/policies/early_years_payments/admin_tasks_presenter_spec.rb @@ -11,12 +11,20 @@ start_date: Date.new(2018, 1, 1) }) } - let(:eligible_ey_provider) { create(:eligible_ey_provider) } + let(:eligible_ey_provider) do + create( + :eligible_ey_provider, + nursery_name: "Some Nursery", + urn: "EY123456" + ) + end subject { described_class.new(claim).employment } it "shows current employment" do - expect(subject[0][1]).to eq claim.eligibility.eligible_ey_provider.nursery_name + expect(subject[0]).to eq( + ["Current employment", "Some Nursery (EY123456)"] + ) end it "shows start date" do