diff --git a/app/assets/javascripts/components/college_search.js.erb b/app/assets/javascripts/components/college_search.js.erb
index 4c95cdd4bb..5b616f5f4e 100644
--- a/app/assets/javascripts/components/college_search.js.erb
+++ b/app/assets/javascripts/components/college_search.js.erb
@@ -21,7 +21,7 @@ document.addEventListener("DOMContentLoaded", function () {
return;
}
- var hiddenInput = form.querySelector("input#claim_school_id");
+ var hiddenInput = form.querySelector("input#claim_possible_school_id");
var schools = [];
diff --git a/app/forms/journeys/further_education_payments/further_education_provision_search_form.rb b/app/forms/journeys/further_education_payments/further_education_provision_search_form.rb
index 958ecd40b9..ffeda949e7 100644
--- a/app/forms/journeys/further_education_payments/further_education_provision_search_form.rb
+++ b/app/forms/journeys/further_education_payments/further_education_provision_search_form.rb
@@ -4,12 +4,12 @@ class FurtherEducationProvisionSearchForm < Form
MIN_LENGTH = 3
attribute :provision_search, :string
- attribute :school_id, :string
+ attribute :possible_school_id, :string
validates :provision_search,
presence: {message: i18n_error_message(:blank)},
length: {minimum: MIN_LENGTH, message: i18n_error_message(:min_length)},
- unless: proc { |object| object.school_id.present? }
+ unless: proc { |object| object.possible_school_id.present? }
def no_results?
provision_search.present? && provision_search.size >= MIN_LENGTH && !has_results
@@ -18,10 +18,18 @@ def no_results?
def save
return if invalid? || no_results?
- journey_session.answers.assign_attributes(
- provision_search:,
- school_id:
- )
+ reset_dependent_answers if changed_answer?
+
+ if possible_school_id.present?
+ journey_session.answers.assign_attributes(
+ possible_school_id:
+ )
+ else
+ journey_session.answers.assign_attributes(
+ provision_search:
+ )
+ end
+
journey_session.save!
true
@@ -30,7 +38,17 @@ def save
private
def has_results
- School.open.search(provision_search).count > 0
+ School.search(provision_search).count > 0
+ end
+
+ def changed_answer?
+ possible_school_id != journey_session.answers.school_id
+ end
+
+ def reset_dependent_answers
+ journey_session.answers.assign_attributes(
+ school_id: nil
+ )
end
end
end
diff --git a/app/forms/journeys/further_education_payments/select_provision_form.rb b/app/forms/journeys/further_education_payments/select_provision_form.rb
index 76b7b7ae32..dbe1196152 100644
--- a/app/forms/journeys/further_education_payments/select_provision_form.rb
+++ b/app/forms/journeys/further_education_payments/select_provision_form.rb
@@ -1,9 +1,9 @@
module Journeys
module FurtherEducationPayments
class SelectProvisionForm < Form
- attribute :school_id, :string # school GUID
+ attribute :possible_school_id, :string # school GUID
- validates :school_id, presence: {message: i18n_error_message(:blank)}
+ validates :possible_school_id, presence: {message: i18n_error_message(:blank)}
def radio_options
results
@@ -12,7 +12,7 @@ def radio_options
def save
return unless valid?
- journey_session.answers.assign_attributes(school_id:)
+ journey_session.answers.assign_attributes(school_id: possible_school_id)
journey_session.save!
true
@@ -21,10 +21,10 @@ def save
private
def results
- @results ||= if journey_session.answers.school_id.present?
- School.open.fe_only.where(id: school_id)
+ @results ||= if journey_session.answers.possible_school_id.present?
+ School.fe_only.where(id: possible_school_id)
else
- School.open.fe_only.search(provision_search)
+ School.fe_only.search(provision_search)
end
end
diff --git a/app/models/journeys/further_education_payments/session_answers.rb b/app/models/journeys/further_education_payments/session_answers.rb
index 888e12fbbf..ab23d6b943 100644
--- a/app/models/journeys/further_education_payments/session_answers.rb
+++ b/app/models/journeys/further_education_payments/session_answers.rb
@@ -3,6 +3,7 @@ module FurtherEducationPayments
class SessionAnswers < Journeys::SessionAnswers
attribute :teaching_responsibilities, :boolean
attribute :provision_search, :string
+ attribute :possible_school_id, :string # GUID
attribute :school_id, :string # GUID
attribute :contract_type, :string
attribute :fixed_term_full_year, :boolean
@@ -29,9 +30,17 @@ def policy
end
def school
+ return unless school_id
+
@school ||= School.find(school_id)
end
+ def possible_school
+ return unless possible_school_id
+
+ @possible_school ||= School.find(possible_school_id)
+ end
+
def teaching_responsibilities?
!!teaching_responsibilities
end
@@ -75,6 +84,27 @@ def less_than_half_hours_teaching_fe?
def hours_teaching_eligible_subjects?
!!hours_teaching_eligible_subjects
end
+
+ def eligible_fe_provider?
+ return unless school
+
+ EligibleFeProvider
+ .where(academic_year: AcademicYear.current)
+ .where(ukprn: school.ukprn)
+ .exists?
+ end
+
+ def ineligible_fe_provider?
+ return unless school
+
+ !eligible_fe_provider?
+ end
+
+ def fe_provider_closed?
+ return unless school
+
+ school.closed?
+ end
end
end
end
diff --git a/app/models/journeys/further_education_payments/slug_sequence.rb b/app/models/journeys/further_education_payments/slug_sequence.rb
index 99a0ac9ced..d2ffb1e140 100644
--- a/app/models/journeys/further_education_payments/slug_sequence.rb
+++ b/app/models/journeys/further_education_payments/slug_sequence.rb
@@ -62,11 +62,7 @@ class SlugSequence
).freeze
def self.start_page_url
- if Rails.env.production?
- "https://www.example.com" # TODO: update to correct guidance
- else
- Rails.application.routes.url_helpers.landing_page_path("further-education-payments")
- end
+ Rails.application.routes.url_helpers.landing_page_path("further-education-payments")
end
attr_reader :journey_session
diff --git a/app/models/policies/further_education_payments.rb b/app/models/policies/further_education_payments.rb
index d7a92a7960..a879b6241b 100644
--- a/app/models/policies/further_education_payments.rb
+++ b/app/models/policies/further_education_payments.rb
@@ -6,6 +6,8 @@ module FurtherEducationPayments
# Percentage of claims to QA
MIN_QA_THRESHOLD = 10
+ URL_SPREADSHEET_ELIGIBLE_PROVIDERS = "https://assets.publishing.service.gov.uk/media/667300fe64e554df3bd0db92/List_of_eligible_FE_providers_and_payment_value_for_levelling_up_premium.xlsx".freeze
+
# TODO: This is needed once the reply-to email address has been added to Gov Notify
def notify_reply_to_id
nil
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 e18921cd46..9b88e9f080 100644
--- a/app/models/policies/further_education_payments/policy_eligibility_checker.rb
+++ b/app/models/policies/further_education_payments/policy_eligibility_checker.rb
@@ -22,6 +22,8 @@ def ineligible?
def ineligibility_reason
if answers.teaching_responsibilities == false
:lack_teaching_responsibilities
+ elsif answers.ineligible_fe_provider? || answers.fe_provider_closed?
+ :fe_provider
elsif answers.taught_at_least_one_term == false
:must_teach_at_least_one_term
elsif !answers.recent_further_education_teacher?
diff --git a/app/views/further_education_payments/claims/_ineligible_fe_provider.html.erb b/app/views/further_education_payments/claims/_ineligible_fe_provider.html.erb
new file mode 100644
index 0000000000..d3e3ec66ec
--- /dev/null
+++ b/app/views/further_education_payments/claims/_ineligible_fe_provider.html.erb
@@ -0,0 +1,34 @@
+
+
+
+ The further education (FE) provider you have entered is not eligible
+
+
+
+ The reason could be:
+
+
+ <%= govuk_list [
+ "the FE provider you have selected is not included in the #{govuk_link_to "list of eligible providers", Policies::FurtherEducationPayments::URL_SPREADSHEET_ELIGIBLE_PROVIDERS }".html_safe,
+ "the spelling of the FE provider does not match our records - check the spelling, including any apostrophes, hyphens or full stops used in the FE provider’s name",
+ "the FE provider you listed is closed - this could be the case if it has rebranded"
+ ], type: :bullet %>
+
+
+ Eligible providers include:
+
+
+ <%= govuk_list [
+ "FE colleges",
+ "sixth-form colleges",
+ "designated institutions",
+ "16 to 19 only academies and free schools"
+ ], type: :bullet %>
+
+ <%= govuk_button_link_to "Change FE provider", claim_path(current_journey_routing_name, "further-education-provision-search") %>
+
+
+ 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 %>.
+
+
+
diff --git a/app/views/further_education_payments/claims/further_education_provision_search.html.erb b/app/views/further_education_payments/claims/further_education_provision_search.html.erb
index 26b68aa245..fe866a738b 100644
--- a/app/views/further_education_payments/claims/further_education_provision_search.html.erb
+++ b/app/views/further_education_payments/claims/further_education_provision_search.html.erb
@@ -11,7 +11,7 @@
html: { novalidate: false } do |f| %>
<%= f.govuk_error_summary %>
- <%= f.hidden_field :school_id %>
+ <%= f.hidden_field :possible_school_id %>
An eligible further education (FE) provider in England must employ you as a teacher
diff --git a/app/views/further_education_payments/claims/select_provision.html.erb b/app/views/further_education_payments/claims/select_provision.html.erb
index d9799df4e1..c4b3e8edfa 100644
--- a/app/views/further_education_payments/claims/select_provision.html.erb
+++ b/app/views/further_education_payments/claims/select_provision.html.erb
@@ -5,7 +5,7 @@
<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %>
<%= f.govuk_error_summary %>
- <%= f.govuk_collection_radio_buttons :school_id, @form.radio_options, :id, :name, :address,
+ <%= f.govuk_collection_radio_buttons :possible_school_id, @form.radio_options, :id, :name, :address,
legend: {
text: @form.t("heading"),
tag: "h1",
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9d8d1eba0f..0ec1ecb549 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -817,6 +817,8 @@ en:
heading: You are not eligible
teaching_less_than_2_5_next_term:
heading: You are not eligible
+ fe_provider:
+ heading: The further education (FE) provider you have entered is not eligible
teaching_responsibilities:
question: Are you a member of staff with teaching responsibilities?
errors:
diff --git a/db/seeds.rb b/db/seeds.rb
index 09580403c4..3fd9ad6e05 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -18,6 +18,11 @@
end
if ENV["ENVIRONMENT_NAME"].start_with?("review")
+ EligibleFeProvidersImporter.new(
+ File.new(Rails.root.join("spec/fixtures/files/eligible_fe_providers.csv")),
+ AcademicYear.current
+ ).run
+
SchoolDataImporterJob.perform_later if School.count < 100
end
diff --git a/spec/factories/schools.rb b/spec/factories/schools.rb
index 80aa124cc8..03cff24fad 100644
--- a/spec/factories/schools.rb
+++ b/spec/factories/schools.rb
@@ -135,7 +135,14 @@
end
trait :further_education do
+ ukprn { rand(10_000_000..19_000_000) }
phase { 6 }
end
+
+ trait :fe_eligible do
+ after(:create) do |school, evaluator|
+ create(:eligible_fe_provider, ukprn: school.ukprn)
+ end
+ end
end
end
diff --git a/spec/features/further_education_payments/happy_js_path_spec.rb b/spec/features/further_education_payments/happy_js_path_spec.rb
index 917a308c6c..6498e8b479 100644
--- a/spec/features/further_education_payments/happy_js_path_spec.rb
+++ b/spec/features/further_education_payments/happy_js_path_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.feature "Further education payments", js: true, flaky: true do
- let(:college) { create(:school, :further_education) }
+ let(:college) { create(:school, :further_education, :fe_eligible) }
scenario "happy js path" do
when_further_education_payments_journey_configuration_exists
diff --git a/spec/features/further_education_payments/happy_path_spec.rb b/spec/features/further_education_payments/happy_path_spec.rb
index a07e28fe5a..9afa73a707 100644
--- a/spec/features/further_education_payments/happy_path_spec.rb
+++ b/spec/features/further_education_payments/happy_path_spec.rb
@@ -1,7 +1,7 @@
require "rails_helper"
RSpec.feature "Further education payments" do
- let(:college) { create(:school, :further_education) }
+ let(:college) { create(:school, :further_education, :fe_eligible) }
scenario "happy path claim" do
when_further_education_payments_journey_configuration_exists
diff --git a/spec/features/further_education_payments/ineligible_paths_spec.rb b/spec/features/further_education_payments/ineligible_paths_spec.rb
index 9e5197ef8c..c7be1598e4 100644
--- a/spec/features/further_education_payments/ineligible_paths_spec.rb
+++ b/spec/features/further_education_payments/ineligible_paths_spec.rb
@@ -1,13 +1,13 @@
require "rails_helper"
RSpec.feature "Further education payments ineligible paths" do
- let(:school) { create(:school, :further_education) }
- let(:college) { school }
+ let(:ineligible_college) { create(:school, :further_education) }
+ let(:eligible_college) { create(:school, :further_education, :fe_eligible) }
+ let(:closed_eligible_college) { create(:school, :further_education, :fe_eligible, :closed) }
let(:current_academic_year) { AcademicYear.current }
scenario "when no teaching responsibilities" do
when_further_education_payments_journey_configuration_exists
- and_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -21,8 +21,121 @@
expect(page).to have_content("you must be employed as a member of staff with teaching responsibilities")
end
+ scenario "when ineligible FE provider is selected" do
+ when_further_education_payments_journey_configuration_exists
+ and_ineligible_college_exists
+ and_eligible_college_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 "Yes"
+ click_button "Continue"
+
+ expect(page).to have_content("Which FE provider are you employed by?")
+ fill_in "Which FE provider are you employed by?", with: ineligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("Select the college you teach at")
+ choose ineligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("The further education (FE) provider you have entered is not eligible")
+ click_link "Change FE provider"
+
+ expect(page).to have_content("Which FE provider are you employed by?")
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("Select the college you teach at")
+ choose eligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
+ end
+
+ scenario "when ineligible FE provider is selected with js", js: true do
+ when_further_education_payments_journey_configuration_exists
+ and_ineligible_college_exists
+ and_eligible_college_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 "Yes"
+ click_button "Continue"
+
+ expect(page).to have_content("Which FE provider are you employed by?")
+ fill_in "Which FE provider are you employed by?", with: ineligible_college.name
+ within("#claim-provision-search-field__listbox") do
+ sleep(1) # seems to aid in success, as if click happens before event is bound
+ find("li", text: ineligible_college.name).click
+ end
+ click_button "Continue"
+
+ expect(page).to have_content("Select the college you teach at")
+ choose ineligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("The further education (FE) provider you have entered is not eligible")
+ click_link "Change FE provider"
+
+ expect(page).to have_content("Which FE provider are you employed by?")
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
+ within("#claim-provision-search-field__listbox") do
+ sleep(1) # seems to aid in success, as if click happens before event is bound
+ find("li", text: eligible_college.name).click
+ end
+ click_button "Continue"
+
+ expect(page).to have_content("Select the college you teach at")
+ choose eligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
+ end
+
+ scenario "when closed FE provider selected" do
+ when_further_education_payments_journey_configuration_exists
+ and_closed_eligible_college_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 "Yes"
+ click_button "Continue"
+
+ expect(page).to have_content("Which FE provider are you employed by?")
+ fill_in "Which FE provider are you employed by?", with: closed_eligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("Select the college you teach at")
+ choose closed_eligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("The further education (FE) provider you have entered is not eligible")
+ click_link "Change FE provider"
+
+ expect(page).to have_content("Which FE provider are you employed by?")
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("Select the college you teach at")
+ choose eligible_college.name
+ click_button "Continue"
+
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
+ end
+
scenario "when fixed term contract and just one academic term taught" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -33,14 +146,14 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose("Fixed-term contract")
click_button "Continue"
@@ -48,8 +161,8 @@
choose("No, it does not cover the full #{current_academic_year.to_s(:long)} academic year")
click_button "Continue"
- expect(page).to have_content("Have you taught at #{college.name} for at least one academic term?")
- choose("No, I have not taught at #{college.name} for at least one academic term")
+ expect(page).to have_content("Have you taught at #{eligible_college.name} for at least one academic term?")
+ choose("No, I have not taught at #{eligible_college.name} for at least one academic term")
click_button "Continue"
expect(page).to have_content("You are not eligible for a financial incentive payment yet")
@@ -57,7 +170,7 @@
scenario "when lacking subjects" do
when_further_education_payments_journey_configuration_exists
- and_college_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -68,14 +181,14 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose "Permanent contract"
click_button "Continue"
@@ -97,7 +210,7 @@
scenario "when variable contract and just one academic term taught" do
when_further_education_payments_journey_configuration_exists
- and_college_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -108,19 +221,19 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose("Variable hours contract")
click_button "Continue"
- expect(page).to have_content("Have you taught at #{college.name} for at least one academic term?")
- choose("No, I have not taught at #{college.name} for at least one academic term")
+ expect(page).to have_content("Have you taught at #{eligible_college.name} for at least one academic term?")
+ choose("No, I have not taught at #{eligible_college.name} for at least one academic term")
click_button "Continue"
expect(page).to have_content("You are not eligible for a financial incentive payment yet")
@@ -128,7 +241,7 @@
scenario "when teaches non eligible course in applicable subject area" do
when_further_education_payments_journey_configuration_exists
- and_college_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -139,14 +252,14 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose "Permanent contract"
click_button "Continue"
@@ -172,6 +285,7 @@
scenario "when not a recent FE teacher" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -182,18 +296,18 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose("Permanent contract")
click_button "Continue"
- expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?")
+ expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{eligible_college.name} during the current term?")
choose("More than 12 hours per week")
click_button "Continue"
@@ -207,6 +321,7 @@
scenario "when teacher is subject to performance measures" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -217,17 +332,18 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose "Permanent contract"
click_button "Continue"
- expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?")
+
+ expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{eligible_college.name} during the current term?")
choose "More than 12 hours per week"
click_button "Continue"
@@ -271,6 +387,7 @@
scenario "when teacher is subject to disciplinary action" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -281,18 +398,18 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose "Permanent contract"
click_button "Continue"
- expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?")
+ expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{eligible_college.name} during the current term?")
choose "More than 12 hours per week"
click_button "Continue"
@@ -336,6 +453,7 @@
scenario "when lacks teaching qualification and no enrol plan" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -346,18 +464,18 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose "Permanent contract"
click_button "Continue"
- expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?")
+ expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{eligible_college.name} during the current term?")
choose "More than 12 hours per week"
click_button "Continue"
@@ -391,6 +509,7 @@
scenario "when permanent contract and not enough hours" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -401,18 +520,18 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose "Permanent contract"
click_button "Continue"
- expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?")
+ expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{eligible_college.name} during the current term?")
choose("Less than 2.5 hours per week")
click_button "Continue"
@@ -422,6 +541,7 @@
scenario "when fixed-term contract and not enough hours" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -432,14 +552,14 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose "Fixed-term contract"
click_button "Continue"
@@ -447,12 +567,12 @@
choose "Yes, it covers the full #{current_academic_year.to_s(:long)} academic year"
click_button "Continue"
- expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?")
+ expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{eligible_college.name} during the current term?")
choose "More than 12 hours per week"
click_button "Continue"
- expect(page).to have_content("Are you timetabled to teach at least 2.5 hours per week at #{college.name} next term?")
- choose("No, I’m not timetabled to teach at least 2.5 hours per week at #{college.name} next term")
+ expect(page).to have_content("Are you timetabled to teach at least 2.5 hours per week at #{eligible_college.name} next term?")
+ choose("No, I’m not timetabled to teach at least 2.5 hours per week at #{eligible_college.name} next term")
click_button "Continue"
expect(page).to have_content("You are not eligible")
@@ -461,6 +581,7 @@
scenario "when variable contract and not enough hours" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -471,27 +592,27 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose("Variable hours contract")
click_button "Continue"
- expect(page).to have_content("Have you taught at #{college.name} for at least one academic term?")
- choose("Yes, I have taught at #{college.name} for at least one academic term")
+ expect(page).to have_content("Have you taught at #{eligible_college.name} for at least one academic term?")
+ choose("Yes, I have taught at #{eligible_college.name} for at least one academic term")
click_button "Continue"
- expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?")
+ expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{eligible_college.name} during the current term?")
choose("More than 12 hours per week")
click_button "Continue"
- expect(page).to have_content("Are you timetabled to teach at least 2.5 hours per week at #{college.name} next term?")
- choose("No, I’m not timetabled to teach at least 2.5 hours per week at #{college.name} next term")
+ expect(page).to have_content("Are you timetabled to teach at least 2.5 hours per week at #{eligible_college.name} next term?")
+ choose("No, I’m not timetabled to teach at least 2.5 hours per week at #{eligible_college.name} next term")
click_button "Continue"
expect(page).to have_content("You are not eligible")
@@ -500,6 +621,7 @@
scenario "when less that 50% teaching hours to FE" do
when_further_education_payments_journey_configuration_exists
+ and_eligible_college_exists
visit landing_page_path(Journeys::FurtherEducationPayments::ROUTING_NAME)
expect(page).to have_link("Start now")
@@ -510,18 +632,18 @@
click_button "Continue"
expect(page).to have_content("Which FE provider are you employed by?")
- fill_in "Which FE provider are you employed by?", with: college.name
+ fill_in "Which FE provider are you employed by?", with: eligible_college.name
click_button "Continue"
expect(page).to have_content("Select the college you teach at")
- choose college.name
+ choose eligible_college.name
click_button "Continue"
- expect(page).to have_content("What type of contract do you have with #{college.name}?")
+ expect(page).to have_content("What type of contract do you have with #{eligible_college.name}?")
choose("Permanent contract")
click_button "Continue"
- expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?")
+ expect(page).to have_content("On average, how many hours per week are you timetabled to teach at #{eligible_college.name} during the current term?")
choose("More than 12 hours per week")
click_button "Continue"
@@ -549,7 +671,15 @@
expect(page).to have_content("half of your timetabled teaching hours must include")
end
- def and_college_exists
- college
+ def and_ineligible_college_exists
+ ineligible_college
+ end
+
+ def and_eligible_college_exists
+ eligible_college
+ end
+
+ def and_closed_eligible_college_exists
+ closed_eligible_college
end
end
diff --git a/spec/fixtures/files/eligible_fe_providers.csv b/spec/fixtures/files/eligible_fe_providers.csv
new file mode 100644
index 0000000000..c48c3ef9f0
--- /dev/null
+++ b/spec/fixtures/files/eligible_fe_providers.csv
@@ -0,0 +1,289 @@
+ukprn,max_award_amount,lower_award_amount
+10083728,4000,2000
+10000055,6000,3000
+10004927,6000,3000
+10057981,6000,3000
+10000330,5000,2500
+10082366,6000,3000
+10000415,6000,3000
+10000528,6000,3000
+10000533,6000,3000
+10000536,6000,3000
+10000552,4000,2000
+10000560,6000,3000
+10001465,6000,3000
+10086696,6000,3000
+10000610,6000,3000
+10000670,5000,2500
+10046350,6000,3000
+10084488,5000,2500
+10064686,6000,3000
+10006442,6000,3000
+10000720,6000,3000
+10000721,6000,3000
+10000747,6000,3000
+10000754,6000,3000
+10088739,6000,3000
+10000794,6000,3000
+10000796,6000,3000
+10000812,6000,3000
+10000840,6000,3000
+10000878,6000,3000
+10000887,4000,2000
+10000944,5000,2500
+10000950,6000,3000
+10000473,6000,3000
+10001000,6000,3000
+10001004,6000,3000
+10001005,6000,3000
+10001093,6000,3000
+10064832,5000,2500
+10092570,4000,2000
+10001116,6000,3000
+10068090,5000,2500
+10001148,6000,3000
+10007455,6000,3000
+10001165,5000,2500
+10001201,5000,2500
+10042362,5000,2500
+10001353,6000,3000
+10005972,6000,3000
+10001378,6000,3000
+10007817,6000,3000
+10001416,6000,3000
+10001446,5000,2500
+10005128,6000,3000
+10001467,6000,3000
+10007945,6000,3000
+10065146,6000,3000
+10001475,6000,3000
+10007578,6000,3000
+10001535,6000,3000
+10042041,6000,3000
+10001696,6000,3000
+10003010,6000,3000
+10001743,6000,3000
+10001778,6000,3000
+10001850,6000,3000
+10001919,6000,3000
+10001934,6000,3000
+10083743,6000,3000
+10004695,6000,3000
+10007924,6000,3000
+10092987,5000,2500
+10002094,6000,3000
+10004116,6000,3000
+10002111,6000,3000
+10047200,6000,3000
+10067981,6000,3000
+10002130,6000,3000
+10002923,6000,3000
+10006570,6000,3000
+10053859,6000,3000
+10065149,4000,2000
+10002370,5000,2500
+10045912,4000,2000
+10002412,5000,2500
+10002570,5000,2500
+10002599,6000,3000
+10002638,6000,3000
+10085525,6000,3000
+10002696,6000,3000
+10065147,4000,2000
+10002743,6000,3000
+10002770,5000,2500
+10002852,6000,3000
+10040630,6000,3000
+10053513,4000,2000
+10002899,6000,3000
+10088761,6000,3000
+10068120,6000,3000
+10093049,5000,2500
+10047216,5000,2500
+10002917,6000,3000
+10080810,4000,2000
+10005979,5000,2500
+10007977,6000,3000
+10007289,6000,3000
+10003022,5000,2500
+10062355,4000,2000
+10003023,5000,2500
+10003029,6000,3000
+10003035,6000,3000
+10003094,4000,2000
+10003128,5000,2500
+10003146,6000,3000
+10007193,6000,3000
+10003188,5000,2500
+10003193,6000,3000
+10003200,6000,3000
+10093051,4000,2000
+10005077,6000,3000
+10003427,6000,3000
+10003491,5000,2500
+10003511,6000,3000
+10003558,5000,2500
+10042040,4000,2000
+10065472,5000,2500
+10086880,5000,2500
+10046829,4000,2000
+10003676,6000,3000
+10003189,6000,3000
+10003753,6000,3000
+10003755,6000,3000
+10003768,6000,3000
+10090876,4000,2000
+10044606,5000,2500
+10003855,6000,3000
+10093053,5000,2500
+10003867,6000,3000
+10003899,6000,3000
+10003928,6000,3000
+10056979,5000,2500
+10037983,5000,2500
+10065007,6000,3000
+10000948,6000,3000
+10004088,4000,2000
+10064664,6000,3000
+10004108,6000,3000
+10004112,5000,2500
+10023139,6000,3000
+10024962,6000,3000
+10004125,6000,3000
+10004144,6000,3000
+10065462,4000,2000
+10004344,6000,3000
+10004340,6000,3000
+10004375,6000,3000
+10004432,6000,3000
+10004442,6000,3000
+10004478,6000,3000
+10004599,6000,3000
+10004552,6000,3000
+10006963,6000,3000
+10083760,6000,3000
+10065005,5000,2500
+10004576,6000,3000
+10063721,5000,2500
+10004579,6000,3000
+10004596,6000,3000
+10004603,6000,3000
+10004607,6000,3000
+10066505,5000,2500
+10004608,6000,3000
+10004686,6000,3000
+10004690,6000,3000
+10004721,6000,3000
+10004718,6000,3000
+10007011,6000,3000
+10004772,6000,3000
+10004785,6000,3000
+10004577,6000,3000
+10004835,6000,3000
+10065145,6000,3000
+10053874,5000,2500
+10005072,4000,2000
+10004676,6000,3000
+10005124,6000,3000
+10005200,6000,3000
+10063846,5000,2500
+10065941,5000,2500
+10094319,5000,2500
+10065473,4000,2000
+10005404,6000,3000
+10065148,4000,2000
+10089242,4000,2000
+10065834,6000,3000
+10003088,6000,3000
+10002863,6000,3000
+10005534,6000,3000
+10063421,6000,3000
+10005575,5000,2500
+10005032,6000,3000
+10046731,4000,2000
+10005669,6000,3000
+10005687,6000,3000
+10005810,6000,3000
+10039420,6000,3000
+10005822,6000,3000
+10005859,6000,3000
+10042335,4000,2000
+10067306,4000,2000
+10005946,6000,3000
+10064663,6000,3000
+10005967,6000,3000
+10093936,6000,3000
+10005977,6000,3000
+10005981,6000,3000
+10036143,6000,3000
+10007928,6000,3000
+10023526,6000,3000
+10003674,6000,3000
+10006038,6000,3000
+10006050,5000,2500
+10006130,5000,2500
+10006135,6000,3000
+10006148,4000,2000
+10008007,6000,3000
+10006174,6000,3000
+10006195,5000,2500
+10065835,6000,3000
+10009439,6000,3000
+10006349,6000,3000
+10006378,5000,2500
+10006398,6000,3000
+10006494,6000,3000
+10007938,6000,3000
+10006549,6000,3000
+10000756,5000,2500
+10000820,6000,3000
+10006813,6000,3000
+10003955,6000,3000
+10001550,4000,2000
+10007916,6000,3000
+10006341,6000,3000
+10003011,4000,2000
+10003406,6000,3000
+10083773,5000,2500
+10001503,6000,3000
+10006770,6000,3000
+10005788,6000,3000
+10005881,4000,2000
+10065175,4000,2000
+10000952,6000,3000
+10005998,6000,3000
+10065942,6000,3000
+10041654,6000,3000
+10055888,6000,3000
+10007063,5000,2500
+10005999,6000,3000
+10001476,6000,3000
+10086705,5000,2500
+10005736,5000,2500
+10007212,5000,2500
+10007315,6000,3000
+10007321,6000,3000
+10007339,6000,3000
+10007859,6000,3000
+10007417,6000,3000
+10007427,6000,3000
+10007431,6000,3000
+10007434,6000,3000
+10007459,6000,3000
+10007469,6000,3000
+10007500,6000,3000
+10007503,6000,3000
+10006864,6000,3000
+10007527,6000,3000
+10002107,5000,2500
+10007546,5000,2500
+10007553,6000,3000
+10007636,4000,2000
+10065150,5000,2500
+10087582,5000,2500
+10065366,5000,2500
+10007671,5000,2500
+10007673,5000,2500
+10007682,6000,3000
+10007696,6000,3000
+10007709,5000,2500
\ No newline at end of file
diff --git a/spec/forms/journeys/further_education_payments/further_education_provision_search_form_spec.rb b/spec/forms/journeys/further_education_payments/further_education_provision_search_form_spec.rb
index d7bbb4d7e1..ab8130978d 100644
--- a/spec/forms/journeys/further_education_payments/further_education_provision_search_form_spec.rb
+++ b/spec/forms/journeys/further_education_payments/further_education_provision_search_form_spec.rb
@@ -6,13 +6,13 @@
let(:college) { create(:school) }
let(:provision_search) { nil }
- let(:school_id) { nil }
+ let(:possible_school_id) { nil }
let(:params) do
ActionController::Parameters.new(
claim: {
provision_search:,
- school_id:
+ possible_school_id:
}
)
end
@@ -62,12 +62,12 @@
end
end
- context "when school_id supplied" do
- let(:school_id) { college.id }
+ context "when possible_school_id supplied" do
+ let(:possible_school_id) { college.id }
- it "updates the journey session with school_id" do
+ it "updates the journey session with possible_school_id" do
expect { expect(subject.save).to be(true) }.to(
- change { journey_session.reload.answers.school_id }.to(school_id)
+ change { journey_session.reload.answers.possible_school_id }.to(possible_school_id)
)
end
end
diff --git a/spec/forms/journeys/further_education_payments/select_provision_form_spec.rb b/spec/forms/journeys/further_education_payments/select_provision_form_spec.rb
index fa907172d7..a526a9cd68 100644
--- a/spec/forms/journeys/further_education_payments/select_provision_form_spec.rb
+++ b/spec/forms/journeys/further_education_payments/select_provision_form_spec.rb
@@ -8,7 +8,7 @@
let(:params) do
ActionController::Parameters.new(
claim: {
- school_id:
+ possible_school_id:
}
)
end
@@ -22,19 +22,19 @@
end
describe "validations" do
- let(:school_id) { nil }
+ let(:possible_school_id) { nil }
it do
is_expected.not_to(
allow_value("")
- .for(:school_id)
+ .for(:possible_school_id)
.with_message("Select the college you teach at")
)
end
end
describe "#save" do
- let(:school_id) { college.id }
+ let(:possible_school_id) { college.id }
it "updates the journey session" do
expect { expect(subject.save).to be(true) }.to(
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
index 99c90d21d3..39230c2ce1 100644
--- a/spec/models/policies/further_education_payments/policy_eligibility_checker_spec.rb
+++ b/spec/models/policies/further_education_payments/policy_eligibility_checker_spec.rb
@@ -2,9 +2,15 @@
describe Policies::FurtherEducationPayments::PolicyEligibilityChecker do
let(:answers) do
- build(:further_education_payments_answers)
+ build(
+ :further_education_payments_answers,
+ school_id: eligible_college.id
+ )
end
+ let(:ineligible_college) { create(:school, :further_education) }
+ let(:eligible_college) { create(:school, :further_education, :fe_eligible) }
+
subject { described_class.new(answers: answers) }
describe "#status, #ineligible?, #ineligibility_reason" do
@@ -20,9 +26,28 @@
end
end
+ context "when ineligible FE provider selected" do
+ let(:answers) do
+ build(
+ :further_education_payments_answers,
+ school_id: ineligible_college.id
+ )
+ 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(:fe_provider)
+ end
+ end
+
context "when have not taught for at least one academic term" do
let(:answers) do
- build(:further_education_payments_answers, taught_at_least_one_term: false)
+ build(
+ :further_education_payments_answers,
+ school_id: eligible_college.id,
+ taught_at_least_one_term: false
+ )
end
it "is ineligble as :must_teach_at_least_one_term" do
@@ -34,7 +59,11 @@
context "when ineligible as lacking subjects taught" do
let(:answers) do
- build(:further_education_payments_answers, subjects_taught: ["none"])
+ build(
+ :further_education_payments_answers,
+ school_id: eligible_college.id,
+ subjects_taught: ["none"]
+ )
end
it "is ineligble as :subject" do
@@ -48,6 +77,7 @@
let(:answers) do
build(
:further_education_payments_answers,
+ school_id: eligible_college.id,
subjects_taught: ["building_construction"],
building_construction_courses: ["none"]
)