Skip to content

Commit

Permalink
FE journey handle ineligible as lack teaching
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Jun 28, 2024
1 parent 099f63c commit 8bd08fd
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions app/models/journeys/further_education_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
module Journeys
module FurtherEducationPayments
class EligibilityChecker < Journeys::EligibilityChecker
def ineligible?
false
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">
You are not eligible
</h1>

<p class="govuk-body">
In order to claim a levelling up premium payment, you must be employed as a member of staff with teaching responsibilities.
</p>

<p class="govuk-body">
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 %>.
</p>

<p class="govuk-body">
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") %>.
</p>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FE ineligible goes here
<%= render "ineligible_#{@form.journey_eligibility_checker.ineligibility_reason}" %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FactoryBot.define do
factory :further_education_payments_answers, class: "Journeys::FurtherEducationPayments::SessionAnswers" do
end
end
22 changes: 22 additions & 0 deletions spec/features/further_education_payments/ineligible_paths_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8bd08fd

Please sign in to comment.