diff --git a/app/forms/journeys/further_education_payments/ineligible_form.rb b/app/forms/journeys/further_education_payments/ineligible_form.rb new file mode 100644 index 0000000000..f5ad3333da --- /dev/null +++ b/app/forms/journeys/further_education_payments/ineligible_form.rb @@ -0,0 +1,9 @@ +module Journeys + module FurtherEducationPayments + class IneligibleForm < Form + def journey_eligibility_checker + @journey_eligibility_checker ||= EligibilityChecker.new(journey_session:) + end + end + end +end diff --git a/app/models/journeys/further_education_payments.rb b/app/models/journeys/further_education_payments.rb index 831bde3558..b16faf484a 100644 --- a/app/models/journeys/further_education_payments.rb +++ b/app/models/journeys/further_education_payments.rb @@ -6,13 +6,14 @@ module FurtherEducationPayments ROUTING_NAME = "further-education-payments" VIEW_PATH = "further_education_payments" I18N_NAMESPACE = "further_education_payments" - POLICIES = [] + POLICIES = [Policies::FurtherEducationPayments] FORMS = { "claims" => { "teaching-responsibilities" => TeachingResponsibilitiesForm, "further-education-provision-search" => FurtherEducationProvisionSearchForm, "select-provision" => SelectProvisionForm, - "subjects-taught" => SubjectsTaughtForm + "subjects-taught" => SubjectsTaughtForm, + "ineligible" => IneligibleForm } } end diff --git a/app/models/journeys/further_education_payments/eligibility_checker.rb b/app/models/journeys/further_education_payments/eligibility_checker.rb index d30c874ca0..534e017321 100644 --- a/app/models/journeys/further_education_payments/eligibility_checker.rb +++ b/app/models/journeys/further_education_payments/eligibility_checker.rb @@ -1,9 +1,6 @@ module Journeys module FurtherEducationPayments class EligibilityChecker < Journeys::EligibilityChecker - def ineligible? - false - end end end end diff --git a/app/models/policies/further_education_payments/policy_eligibility_checker.rb b/app/models/policies/further_education_payments/policy_eligibility_checker.rb index 08f9abb3e7..b9fd1b46a1 100644 --- a/app/models/policies/further_education_payments/policy_eligibility_checker.rb +++ b/app/models/policies/further_education_payments/policy_eligibility_checker.rb @@ -10,11 +10,19 @@ def initialize(answers:) end def status + return :ineligible if ineligible? + :eligible_now end def ineligible? - false + ineligibility_reason.present? + end + + def ineligibility_reason + if answers.teaching_responsibilities == false + :lack_teaching_responsibilities + end end end end diff --git a/app/views/further_education_payments/claims/_ineligible_lack_teaching_responsibilities.html.erb b/app/views/further_education_payments/claims/_ineligible_lack_teaching_responsibilities.html.erb new file mode 100644 index 0000000000..e22255f18a --- /dev/null +++ b/app/views/further_education_payments/claims/_ineligible_lack_teaching_responsibilities.html.erb @@ -0,0 +1,19 @@ +
+
+

+ You are not eligible +

+ +

+ In order to claim a levelling up premium payment, you must be employed as a member of staff with teaching responsibilities. +

+ +

+ For more information, check the eligibility criteria for <%= govuk_link_to "levelling up premium payments for early career further education teachers", "https://www.gov.uk/guidance/levelling-up-premium-payments-for-fe-teachers", new_tab: true %>. +

+ +

+ The information entered is not stored. If you are unsure your information is correct, <%= govuk_link_to "start again", claim_path(current_journey_routing_name, "claim") %>. +

+
+
diff --git a/app/views/further_education_payments/claims/ineligible.html.erb b/app/views/further_education_payments/claims/ineligible.html.erb index 438136931e..d95a12b23f 100644 --- a/app/views/further_education_payments/claims/ineligible.html.erb +++ b/app/views/further_education_payments/claims/ineligible.html.erb @@ -1 +1 @@ -FE ineligible goes here +<%= render "ineligible_#{@form.journey_eligibility_checker.ineligibility_reason}" %> diff --git a/spec/factories/journeys/further_education_payments/session_answers.rb b/spec/factories/journeys/further_education_payments/session_answers.rb new file mode 100644 index 0000000000..9c2bf044aa --- /dev/null +++ b/spec/factories/journeys/further_education_payments/session_answers.rb @@ -0,0 +1,4 @@ +FactoryBot.define do + factory :further_education_payments_answers, class: "Journeys::FurtherEducationPayments::SessionAnswers" do + end +end diff --git a/spec/features/further_education_payments/ineligible_paths_spec.rb b/spec/features/further_education_payments/ineligible_paths_spec.rb new file mode 100644 index 0000000000..833894e426 --- /dev/null +++ b/spec/features/further_education_payments/ineligible_paths_spec.rb @@ -0,0 +1,22 @@ +require "rails_helper" + +RSpec.feature "Further education payments ineligible paths" do + scenario "when no teaching responsibilities" do + when_further_education_payments_journey_configuration_exists + + visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME) + expect(page).to have_link("Start now") + click_link "Start now" + + expect(page).to have_content("Are you a member of staff with teaching responsibilities?") + choose "No" + click_button "Continue" + + expect(page).to have_content("You are not eligible") + expect(page).to have_content("you must be employed as a member of staff with teaching responsibilities") + end + + def when_further_education_payments_journey_configuration_exists + create(:journey_configuration, :further_education_payments) + end +end diff --git a/spec/models/policies/further_education_payments/policy_eligibility_checker_spec.rb b/spec/models/policies/further_education_payments/policy_eligibility_checker_spec.rb new file mode 100644 index 0000000000..d7c9d52da9 --- /dev/null +++ b/spec/models/policies/further_education_payments/policy_eligibility_checker_spec.rb @@ -0,0 +1,23 @@ +require "rails_helper" + +describe Policies::FurtherEducationPayments::PolicyEligibilityChecker do + let(:answers) do + build(:further_education_payments_answers) + end + + subject { described_class.new(answers: answers) } + + describe "#status, #ineligible?, #ineligibility_reason" do + context "when ineligible as lacking teaching responsibility" do + let(:answers) do + build(:further_education_payments_answers, teaching_responsibilities: false) + end + + it "is ineligble as :lack_teaching_responsibilities" do + expect(subject).to be_ineligible + expect(subject.status).to eql(:ineligible) + expect(subject.ineligibility_reason).to eql(:lack_teaching_responsibilities) + end + end + end +end