diff --git a/app/forms/journeys/further_education_payments/building_construction_courses_form.rb b/app/forms/journeys/further_education_payments/building_construction_courses_form.rb new file mode 100644 index 0000000000..cca967b415 --- /dev/null +++ b/app/forms/journeys/further_education_payments/building_construction_courses_form.rb @@ -0,0 +1,70 @@ +module Journeys + module FurtherEducationPayments + class BuildingConstructionCoursesForm < Form + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::OutputSafetyHelper + include GovukVisuallyHiddenHelper + include GovukLinkHelper + + attribute :building_construction_courses, default: [] + + before_validation :clean_courses + + validates :building_construction_courses, + presence: {message: i18n_error_message(:inclusion)}, + inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} + + def course_field + :building_construction_courses + end + + def checkbox_options + [ + OpenStruct.new( + id: "esfa_buildingconstruction", + name: t( + "options.esfa_buildingconstruction", + link: govuk_link_to("building and construction", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=7", new_tab: true) + ) + ), + OpenStruct.new( + id: "tlevel_building", + name: t("options.tlevel_building") + ), + OpenStruct.new( + id: "tlevel_onsiteconstruction", + name: t("options.tlevel_onsiteconstruction") + ), + OpenStruct.new( + id: "tlevel_design_surveying", + name: t("options.tlevel_design_surveying") + ), + OpenStruct.new( + id: "level2_3_apprenticeship", + name: t( + "options.level2_3_apprenticeship", + link: govuk_link_to("construction and the built environment occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/construction", new_tab: true) + ) + ), + OpenStruct.new( + id: "none", + name: t("options.none") + ) + ] + end + + def save + return false if invalid? + + journey_session.answers.assign_attributes(building_construction_courses:) + journey_session.save! + end + + private + + def clean_courses + building_construction_courses.reject!(&:blank?) + end + end + end +end diff --git a/app/forms/journeys/further_education_payments/chemistry_courses_form.rb b/app/forms/journeys/further_education_payments/chemistry_courses_form.rb new file mode 100644 index 0000000000..207d9d9665 --- /dev/null +++ b/app/forms/journeys/further_education_payments/chemistry_courses_form.rb @@ -0,0 +1,56 @@ +module Journeys + module FurtherEducationPayments + class ChemistryCoursesForm < Form + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::OutputSafetyHelper + include GovukVisuallyHiddenHelper + include GovukLinkHelper + + attribute :chemistry_courses, default: [] + + before_validation :clean_courses + + validates :chemistry_courses, + presence: {message: i18n_error_message(:inclusion)}, + inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} + + def course_field + :chemistry_courses + end + + def checkbox_options + [ + OpenStruct.new( + id: "alevel_chemistry", + name: t("options.alevel_chemistry") + ), + OpenStruct.new( + id: "gcse_chemistry", + name: t("options.gcse_chemistry") + ), + OpenStruct.new( + id: "ib_certificate_chemistry", + name: t("options.ib_certificate_chemistry") + ), + OpenStruct.new( + id: "none", + name: t("options.none") + ) + ] + end + + def save + return false if invalid? + + journey_session.answers.assign_attributes(chemistry_courses:) + journey_session.save! + end + + private + + def clean_courses + chemistry_courses.reject!(&:blank?) + end + end + end +end diff --git a/app/forms/journeys/further_education_payments/computing_courses_form.rb b/app/forms/journeys/further_education_payments/computing_courses_form.rb new file mode 100644 index 0000000000..edd019ac52 --- /dev/null +++ b/app/forms/journeys/further_education_payments/computing_courses_form.rb @@ -0,0 +1,85 @@ +module Journeys + module FurtherEducationPayments + class ComputingCoursesForm < Form + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::OutputSafetyHelper + include GovukVisuallyHiddenHelper + include GovukLinkHelper + + attribute :computing_courses, default: [] + + before_validation :clean_courses + + validates :computing_courses, + presence: {message: i18n_error_message(:inclusion)}, + inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} + + def course_field + :computing_courses + end + + def checkbox_options + [ + OpenStruct.new( + id: "esfa_digitalpractitioners", + name: t( + "options.esfa_digitalpractitioners", + link: govuk_link_to("digital technology for practitioners", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=23&PageSize=10&Sort=Status", new_tab: true) + ) + ), + OpenStruct.new( + id: "esfa_digitalusers", + name: t( + "options.esfa_digitalusers", + link: govuk_link_to("digital technology for users", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=22&PageSize=10&Sort=Status", new_tab: true) + ) + ), + OpenStruct.new( + id: "digitalskills_quals", + name: t("options.digitalskills_quals") + ), + OpenStruct.new( + id: "tlevel_digitalsupport", + name: t("options.tlevel_digitalsupport") + ), + OpenStruct.new( + id: "tlevel_digitalbusiness", + name: t("options.tlevel_digitalbusiness") + ), + OpenStruct.new( + id: "tlevel_digitalproduction", + name: t("options.tlevel_digitalproduction") + ), + OpenStruct.new( + id: "ib_certificate_compsci", + name: t("options.ib_certificate_compsci") + ), + OpenStruct.new( + id: "level2_3_apprenticeship", + name: t( + "options.level2_3_apprenticeship", + link: govuk_link_to("digital occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/digital", new_tab: true) + ) + ), + OpenStruct.new( + id: "none", + name: t("options.none") + ) + ] + end + + def save + return false if invalid? + + journey_session.answers.assign_attributes(computing_courses:) + journey_session.save! + end + + private + + def clean_courses + computing_courses.reject!(&:blank?) + end + end + end +end diff --git a/app/forms/journeys/further_education_payments/early_years_courses_form.rb b/app/forms/journeys/further_education_payments/early_years_courses_form.rb new file mode 100644 index 0000000000..e0d32a4f06 --- /dev/null +++ b/app/forms/journeys/further_education_payments/early_years_courses_form.rb @@ -0,0 +1,63 @@ +module Journeys + module FurtherEducationPayments + class EarlyYearsCoursesForm < Form + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::OutputSafetyHelper + include GovukVisuallyHiddenHelper + include GovukLinkHelper + + attribute :early_years_courses, default: [] + + before_validation :clean_courses + + validates :early_years_courses, + presence: {message: i18n_error_message(:inclusion)}, + inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} + + def course_field + :early_years_courses + end + + def checkbox_options + [ + OpenStruct.new( + id: "eylevel2", + name: t("options.eylevel2") + ), + OpenStruct.new( + id: "eylevel3", + name: t("options.eylevel3") + ), + OpenStruct.new( + id: "eytlevel", + name: t("options.eytlevel") + ), + OpenStruct.new( + id: "coursetoeyq", + name: t( + "options.coursetoeyq", + link: govuk_link_to("early years qualification", "https://www.gov.uk/government/publications/early-years-qualifications-achieved-in-england", new_tab: true) + ) + ), + OpenStruct.new( + id: "none", + name: t("options.none") + ) + ] + end + + def save + return false if invalid? + + journey_session.answers.assign_attributes(early_years_courses:) + journey_session.save! + end + + private + + def clean_courses + early_years_courses.reject!(&:blank?) + end + end + end +end diff --git a/app/forms/journeys/further_education_payments/engineering_manufacturing_courses_form.rb b/app/forms/journeys/further_education_payments/engineering_manufacturing_courses_form.rb new file mode 100644 index 0000000000..47554c2e48 --- /dev/null +++ b/app/forms/journeys/further_education_payments/engineering_manufacturing_courses_form.rb @@ -0,0 +1,84 @@ +module Journeys + module FurtherEducationPayments + class EngineeringManufacturingCoursesForm < Form + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::OutputSafetyHelper + include GovukVisuallyHiddenHelper + include GovukLinkHelper + + attribute :engineering_manufacturing_courses, default: [] + + before_validation :clean_courses + + validates :engineering_manufacturing_courses, + presence: {message: i18n_error_message(:inclusion)}, + inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} + + def course_field + :engineering_manufacturing_courses + end + + def checkbox_options + [ + OpenStruct.new( + id: "esfa_engineering", + name: t( + "options.esfa_engineering", + link: govuk_link_to("engineering", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=13&PageSize=10&Sort=Status", new_tab: true) + ) + ), + OpenStruct.new( + id: "esfa_manufacturing", + name: t( + "options.esfa_manufacturing", + link: govuk_link_to("manufacturing technologies", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=26&PageSize=10&Sort=Status", new_tab: true) + ) + ), + OpenStruct.new( + id: "esfa_transportation", + name: t( + "options.esfa_transportation", + link: govuk_link_to("transportation operations and maintenance", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=47&PageSize=10&Sort=Status", new_tab: true) + ) + ), + OpenStruct.new( + id: "tlevel_design", + name: t("options.tlevel_design") + ), + OpenStruct.new( + id: "tlevel_maintenance", + name: t("options.tlevel_maintenance") + ), + OpenStruct.new( + id: "tlevel_engineering", + name: t("options.tlevel_engineering") + ), + OpenStruct.new( + id: "level2_3_apprenticeship", + name: t( + "options.level2_3_apprenticeship", + link: govuk_link_to("engineering and manufacturing occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/engineering-manufacturing", new_tab: true) + ) + ), + OpenStruct.new( + id: "none", + name: t("options.none") + ) + ] + end + + def save + return false if invalid? + + journey_session.answers.assign_attributes(engineering_manufacturing_courses:) + journey_session.save! + end + + private + + def clean_courses + engineering_manufacturing_courses.reject!(&:blank?) + end + end + end +end diff --git a/app/forms/journeys/further_education_payments/maths_courses_form.rb b/app/forms/journeys/further_education_payments/maths_courses_form.rb new file mode 100644 index 0000000000..0e34f9748e --- /dev/null +++ b/app/forms/journeys/further_education_payments/maths_courses_form.rb @@ -0,0 +1,58 @@ +module Journeys + module FurtherEducationPayments + class MathsCoursesForm < Form + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::OutputSafetyHelper + include GovukVisuallyHiddenHelper + include GovukLinkHelper + + attribute :maths_courses, default: [] + + before_validation :clean_courses + + validates :maths_courses, + presence: {message: i18n_error_message(:inclusion)}, + inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} + + def course_field + :maths_courses + end + + def checkbox_options + [ + OpenStruct.new( + id: "esfa", + name: t( + "options.esfa", + link: govuk_link_to("mathematics and statistics", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=28&PageSize=10&Sort=Status", new_tab: true) + ) + ), + OpenStruct.new( + id: "gcse_maths", + name: t( + "options.gcse_maths", + link: govuk_link_to("other maths qualifications", "https://submit-learner-data.service.gov.uk/find-a-learning-aim/LearningAimSearchResult?TeachingYear=2324&HasFilters=False&EFAFundingConditions=EFACONFUNDMATHS", new_tab: true) + ) + ), + OpenStruct.new( + id: "none", + name: t("options.none") + ) + ] + end + + def save + return false if invalid? + + journey_session.answers.assign_attributes(maths_courses:) + journey_session.save! + end + + private + + def clean_courses + maths_courses.reject!(&:blank?) + end + end + end +end diff --git a/app/forms/journeys/further_education_payments/physics_courses_form.rb b/app/forms/journeys/further_education_payments/physics_courses_form.rb new file mode 100644 index 0000000000..04c58453fc --- /dev/null +++ b/app/forms/journeys/further_education_payments/physics_courses_form.rb @@ -0,0 +1,56 @@ +module Journeys + module FurtherEducationPayments + class PhysicsCoursesForm < Form + include ActionView::Helpers::UrlHelper + include ActionView::Helpers::OutputSafetyHelper + include GovukVisuallyHiddenHelper + include GovukLinkHelper + + attribute :physics_courses, default: [] + + before_validation :clean_courses + + validates :physics_courses, + presence: {message: i18n_error_message(:inclusion)}, + inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} + + def course_field + :physics_courses + end + + def checkbox_options + [ + OpenStruct.new( + id: "alevel_physics", + name: t("options.alevel_physics") + ), + OpenStruct.new( + id: "gcse_physics", + name: t("options.gcse_physics") + ), + OpenStruct.new( + id: "ib_certificate_physics", + name: t("options.ib_certificate_physics") + ), + OpenStruct.new( + id: "none", + name: t("options.none") + ) + ] + end + + def save + return false if invalid? + + journey_session.answers.assign_attributes(physics_courses:) + journey_session.save! + end + + private + + def clean_courses + physics_courses.reject!(&:blank?) + end + end + end +end diff --git a/app/forms/journeys/further_education_payments/subjects_taught_form.rb b/app/forms/journeys/further_education_payments/subjects_taught_form.rb index a3998d4399..cfac6266b9 100644 --- a/app/forms/journeys/further_education_payments/subjects_taught_form.rb +++ b/app/forms/journeys/further_education_payments/subjects_taught_form.rb @@ -13,19 +13,21 @@ class SubjectsTaughtForm < Form def checkbox_options [ - OpenStruct.new(id: "building_and_construction", name: t("options.building_and_construction")), + OpenStruct.new(id: "building_construction", name: t("options.building_construction")), OpenStruct.new(id: "chemistry", name: t("options.chemistry")), OpenStruct.new(id: "computing", name: t("options.computing")), OpenStruct.new(id: "early_years", name: t("options.early_years")), - OpenStruct.new(id: "engineering_and_manufacturing", name: t("options.engineering_and_manufacturing")), - OpenStruct.new(id: "mathematics", name: t("options.mathematics")), + OpenStruct.new(id: "engineering_manufacturing", name: t("options.engineering_manufacturing")), + OpenStruct.new(id: "maths", name: t("options.maths")), OpenStruct.new(id: "physics", name: t("options.physics")), OpenStruct.new(id: "none", name: t("options.none")) ] end def save - return false unless valid? + return false if invalid? + + reset_dependent_answers journey_session.answers.assign_attributes(subjects_taught:) journey_session.save! @@ -36,6 +38,16 @@ def save def clean_subjects_taught subjects_taught.reject!(&:blank?) end + + def reset_dependent_answers + unchecked_subjects.each do |subject| + journey_session.answers.assign_attributes("#{subject}_courses" => []) + end + end + + def unchecked_subjects + journey_session.answers.subjects_taught - subjects_taught - ["none"] + end end end end diff --git a/app/forms/journeys/further_education_payments/teaching_responsibilities_form.rb b/app/forms/journeys/further_education_payments/teaching_responsibilities_form.rb index 7d9f872f80..430c3766da 100644 --- a/app/forms/journeys/further_education_payments/teaching_responsibilities_form.rb +++ b/app/forms/journeys/further_education_payments/teaching_responsibilities_form.rb @@ -17,7 +17,7 @@ def radio_options end def save - return false unless valid? + return false if invalid? journey_session.answers.assign_attributes(teaching_responsibilities:) journey_session.save! diff --git a/app/models/journeys/further_education_payments.rb b/app/models/journeys/further_education_payments.rb index 68557eb493..8facc123c5 100644 --- a/app/models/journeys/further_education_payments.rb +++ b/app/models/journeys/further_education_payments.rb @@ -19,6 +19,13 @@ module FurtherEducationPayments "teaching-hours-per-week-next-term" => TeachingHoursPerWeekNextTermForm, "further-education-teaching-start-year" => FurtherEducationTeachingStartYearForm, "subjects-taught" => SubjectsTaughtForm, + "building-construction-courses" => BuildingConstructionCoursesForm, + "chemistry-courses" => ChemistryCoursesForm, + "computing-courses" => ComputingCoursesForm, + "early-years-courses" => EarlyYearsCoursesForm, + "engineering-manufacturing-courses" => EngineeringManufacturingCoursesForm, + "maths-courses" => MathsCoursesForm, + "physics-courses" => PhysicsCoursesForm, "teaching-qualification" => TeachingQualificationForm, "poor-performance" => PoorPerformanceForm, "check-your-answers" => CheckYourAnswersForm, diff --git a/app/models/journeys/further_education_payments/session_answers.rb b/app/models/journeys/further_education_payments/session_answers.rb index c393cdcf69..fe163abe3e 100644 --- a/app/models/journeys/further_education_payments/session_answers.rb +++ b/app/models/journeys/further_education_payments/session_answers.rb @@ -11,6 +11,13 @@ class SessionAnswers < Journeys::SessionAnswers attribute :teaching_hours_per_week_next_term, :string attribute :further_education_teaching_start_year, :string attribute :subjects_taught, default: [] + attribute :building_construction_courses, default: [] + attribute :chemistry_courses, default: [] + attribute :computing_courses, default: [] + attribute :early_years_courses, default: [] + attribute :engineering_manufacturing_courses, default: [] + attribute :maths_courses, default: [] + attribute :physics_courses, default: [] attribute :teaching_qualification, :string attribute :subject_to_formal_performance_action, :boolean attribute :subject_to_disciplinary_action, :boolean diff --git a/app/models/journeys/further_education_payments/slug_sequence.rb b/app/models/journeys/further_education_payments/slug_sequence.rb index 80fa3ce13d..fce721fa00 100644 --- a/app/models/journeys/further_education_payments/slug_sequence.rb +++ b/app/models/journeys/further_education_payments/slug_sequence.rb @@ -12,7 +12,13 @@ class SlugSequence teaching-hours-per-week-next-term further-education-teaching-start-year subjects-taught - building-and-construction-courses + building-construction-courses + chemistry-courses + computing-courses + early-years-courses + engineering-manufacturing-courses + maths-courses + physics-courses teaching-courses half-teaching-hours teaching-qualification @@ -59,6 +65,34 @@ def slugs if answers.fixed_term_full_year == true sequence.delete("taught-at-least-one-term") end + + if answers.subjects_taught.exclude?("building_construction") + sequence.delete("building-and-construction-courses") + end + + if answers.subjects_taught.exclude?("chemistry") + sequence.delete("chemistry-courses") + end + + if answers.subjects_taught.exclude?("computing") + sequence.delete("computing-courses") + end + + if answers.subjects_taught.exclude?("early_years") + sequence.delete("early-years-courses") + end + + if answers.subjects_taught.exclude?("engineering_manufacturing") + sequence.delete("engineering-manufacturing-courses") + end + + if answers.subjects_taught.exclude?("maths") + sequence.delete("maths-courses") + end + + if answers.subjects_taught.exclude?("physics") + sequence.delete("physics-courses") + 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 c9855e9b43..e18921cd46 100644 --- a/app/models/policies/further_education_payments/policy_eligibility_checker.rb +++ b/app/models/policies/further_education_payments/policy_eligibility_checker.rb @@ -36,6 +36,22 @@ def ineligibility_reason :lacks_teacher_qualification_or_enrolment elsif answers.less_than_half_hours_teaching_fe? :must_at_least_half_hours_teaching_fe + elsif answers.subjects_taught.include? "none" + :subject + elsif all_selected_courses_ineligible? + :courses + end + end + + private + + def all_selected_courses_ineligible? + groups = answers.subjects_taught.reject { |e| e == "none" } + + return if groups.empty? + + groups.all? do |subject| + answers.public_send(:"#{subject}_courses").include?("none") end end end diff --git a/app/views/further_education_payments/claims/_courses.html.erb b/app/views/further_education_payments/claims/_courses.html.erb new file mode 100644 index 0000000000..ff34fb6e4f --- /dev/null +++ b/app/views/further_education_payments/claims/_courses.html.erb @@ -0,0 +1,36 @@ +
+ In order to claim a levelling up premium payment, you must teach an <%= govuk_link_to "eligible FE course", "https://www.gov.uk/guidance/levelling-up-premium-payments-for-fe-teachers#eligible-fe-courses", new_tab: true %>. +
+ ++ 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, "landing-page") %>. +
++ In order to claim a levelling up premium payment, you must teach an <%= govuk_link_to "eligible FE subject", "https://www.gov.uk/guidance/levelling-up-premium-payments-for-fe-teachers#eligible-fe-courses", new_tab: true %>. +
+ ++ 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, "landing-page") %>. +
+- FE building and construction courses goes here -
- -<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %> - <%= f.govuk_submit %> -<% end %> diff --git a/app/views/further_education_payments/claims/building_construction_courses.html.erb b/app/views/further_education_payments/claims/building_construction_courses.html.erb new file mode 100644 index 0000000000..72fd5d68a1 --- /dev/null +++ b/app/views/further_education_payments/claims/building_construction_courses.html.erb @@ -0,0 +1 @@ +<%= render "courses" %> diff --git a/app/views/further_education_payments/claims/chemistry_courses.html.erb b/app/views/further_education_payments/claims/chemistry_courses.html.erb new file mode 100644 index 0000000000..72fd5d68a1 --- /dev/null +++ b/app/views/further_education_payments/claims/chemistry_courses.html.erb @@ -0,0 +1 @@ +<%= render "courses" %> diff --git a/app/views/further_education_payments/claims/computing_courses.html.erb b/app/views/further_education_payments/claims/computing_courses.html.erb new file mode 100644 index 0000000000..72fd5d68a1 --- /dev/null +++ b/app/views/further_education_payments/claims/computing_courses.html.erb @@ -0,0 +1 @@ +<%= render "courses" %> diff --git a/app/views/further_education_payments/claims/early_years_courses.html.erb b/app/views/further_education_payments/claims/early_years_courses.html.erb new file mode 100644 index 0000000000..72fd5d68a1 --- /dev/null +++ b/app/views/further_education_payments/claims/early_years_courses.html.erb @@ -0,0 +1 @@ +<%= render "courses" %> diff --git a/app/views/further_education_payments/claims/engineering_manufacturing_courses.html.erb b/app/views/further_education_payments/claims/engineering_manufacturing_courses.html.erb new file mode 100644 index 0000000000..72fd5d68a1 --- /dev/null +++ b/app/views/further_education_payments/claims/engineering_manufacturing_courses.html.erb @@ -0,0 +1 @@ +<%= render "courses" %> diff --git a/app/views/further_education_payments/claims/maths_courses.html.erb b/app/views/further_education_payments/claims/maths_courses.html.erb new file mode 100644 index 0000000000..72fd5d68a1 --- /dev/null +++ b/app/views/further_education_payments/claims/maths_courses.html.erb @@ -0,0 +1 @@ +<%= render "courses" %> diff --git a/app/views/further_education_payments/claims/physics_courses.html.erb b/app/views/further_education_payments/claims/physics_courses.html.erb new file mode 100644 index 0000000000..72fd5d68a1 --- /dev/null +++ b/app/views/further_education_payments/claims/physics_courses.html.erb @@ -0,0 +1 @@ +<%= render "courses" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 4b80bc1019..4fa299455a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -815,8 +815,8 @@ en: landing_page: Find out if you are eligible for any incentive payments for further education teachers claim_description: for further education payments journey_name: Claim incentive payments for further education teachers - feedback_email: "fe-levellingup.premiumpayments@education.gov.uk" - support_email_address: "fe-levellingup.premiumpayments@education.gov.uk" + feedback_email: "FE-Levellingup.PremiumPayments@education.gov.uk" + support_email_address: "FE-Levellingup.PremiumPayments@education.gov.uk" forms: teaching_responsibilities: question: Are you a member of staff with teaching responsibilities? @@ -880,16 +880,89 @@ en: question: Which subject areas do you teach? hint: Select all that apply options: - building_and_construction: Building and construction + building_construction: Building and construction chemistry: Chemistry computing: Computing, including digital and ICT early_years: Early years - engineering_and_manufacturing: Engineering and manufacturing, including transport engineering and electronics - mathematics: Mathematics + engineering_manufacturing: Engineering and manufacturing, including transport engineering and electronics + maths: Maths physics: Physics none: I do not teach any of these subjects errors: inclusion: Select the subject areas you teach in or select you do not teach any of the listed subject areas + courses: &courses + hint: | +If you are unsure whether the course(s) you teach is eligible, please email:
%{email}
Select all that apply
+ errors: + inclusion: Select all the courses you teach otherwise select you do not teach any of these courses + building_construction_courses: + <<: *courses + question: Which building and construction courses do you teach? + options: + esfa_buildingconstruction: ESFA-funded qualifications at level 3 and below in the %{link} sector subject area + tlevel_building: T Level in building services engineering for construction + tlevel_onsiteconstruction: T Level in onsite construction + tlevel_design_surveying: T Level in design, surveying and planning for construction + level2_3_apprenticeship: Level 2 or level 3 apprenticeships in the %{link} + none: I do not teach any of these courses + chemistry_courses: + <<: *courses + question: Which chemistry courses do you teach? + options: + alevel_chemistry: A or AS level chemistry + gcse_chemistry: GCSE chemistry + ib_certificate_chemistry: International baccalaureate middle years programme or certificate in chemistry + none: I do not teach any of these courses + computing_courses: + <<: *courses + question: Which computing courses do you teach? + options: + esfa_digitalpractitioners: ESFA-funded qualifications at level 3 and below in the %{link} sector subject area + esfa_digitalusers: ESFA-funded qualifications at level 3 and below in the %{link} sector subject area + digitalskills_quals: Digital functional skills qualifications and essential digital skills qualifications + tlevel_digitalsupport: T Level in digital support services + tlevel_digitalbusiness: T Level in digital business services + tlevel_digitalproduction: T Level in digital production, design and development + ib_certificate_compsci: International baccalaureate certificate in computer science + level2_3_apprenticeship: Level 2 or level 3 apprenticeships in the %{link} + none: I do not teach any of these courses + early_years_courses: + <<: *courses + question: Which early years courses do you teach? + options: + eylevel2: Early years practitioner (level 2) apprenticeship + eylevel3: Early years educator (level 3) apprenticeship + eytlevel: T Level in education and early years (early years educator) + coursetoeyq: A course that leads to an %{link} which enables providers to count the recipient in staff:child ratios + none: I do not teach any of these courses + engineering_manufacturing_courses: + <<: *courses + question: Which engineering and manufacturing courses do you teach? + options: + esfa_engineering: ESFA-funded qualifications at level 3 and below in the %{link} sector subject area + esfa_manufacturing: ESFA-funded qualifications at level 3 and below in the %{link} sector subject area + esfa_transportation: ESFA-funded qualifications at level 3 and below in the %{link} sector subject area + tlevel_design: T Level in design and development for engineering and manufacturing + tlevel_maintenance: T Level in maintenance, installation and repair for engineering and manufacturing + tlevel_engineering: T Level in engineering, manufacturing, processing and control + level2_3_apprenticeship: Level 2 or level 3 apprenticeships in the %{link} + none: I do not teach any of these courses + maths_courses: + <<: *courses + question: Which maths courses do you teach? + options: + esfa: ESFA-funded qualifications at level 3 and below in the %{link} sector subject area + gcse_maths: Maths GCSE, functional skills qualifications and %{link} approved for teaching to 16 to 19-year-olds who meet the condition of funding + none: I do not teach any of these courses + physics_courses: + <<: *courses + question: Which physics courses do you teach? + options: + alevel_physics: A or AS level physics + gcse_physics: GCSE physics + ib_certificate_physics: International baccalaureate middle years programme or certificate in physics + none: I do not teach any of these courses teaching_qualification: question: Do you have a teaching qualification? hint: Your response will be noted for future claims. If you don’t have a teaching qualification yet, make sure that you enrol on one or complete one in the next 12 months. 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 0d6cfda610..0d22d9fca7 100644 --- a/spec/features/further_education_payments/happy_js_path_spec.rb +++ b/spec/features/further_education_payments/happy_js_path_spec.rb @@ -18,6 +18,7 @@ expect(page).to have_content("Which FE provider are you employed by?") fill_in "Which FE provider are you employed by?", with: 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: college.name).click end click_button "Continue" @@ -42,7 +43,8 @@ check("Building and construction") click_button "Continue" - expect(page).to have_content("FE building and construction courses goes here") + expect(page).to have_content("Which building and construction courses do you teach?") + check "T Level in building services engineering for construction" click_button "Continue" expect(page).to have_content("FE teaching courses goes here") diff --git a/spec/features/further_education_payments/happy_path_spec.rb b/spec/features/further_education_payments/happy_path_spec.rb index 2b031dec70..0eb243b898 100644 --- a/spec/features/further_education_payments/happy_path_spec.rb +++ b/spec/features/further_education_payments/happy_path_spec.rb @@ -37,9 +37,40 @@ expect(page).to have_content("Which subject areas do you teach?") check("Building and construction") + check("Chemistry") + check("Computing, including digital and ICT") + check("Early years") + check("Engineering and manufacturing, including transport engineering and electronics") + check("Maths") + check("Physics") click_button "Continue" - expect(page).to have_content("FE building and construction courses goes here") + expect(page).to have_content("Which building and construction courses do you teach?") + check "T Level in building services engineering for construction" + click_button "Continue" + + expect(page).to have_content("Which chemistry courses do you teach?") + check "GCSE chemistry" + click_button "Continue" + + expect(page).to have_content("Which computing courses do you teach?") + check "T Level in digital support services" + click_button "Continue" + + expect(page).to have_content("Which early years courses do you teach?") + check "T Level in education and early years (early years educator)" + click_button "Continue" + + expect(page).to have_content("Which engineering and manufacturing courses do you teach?") + check "T Level in design and development for engineering and manufacturing" + click_button "Continue" + + expect(page).to have_content("Which maths courses do you teach?") + check("claim-maths-courses-esfa-field") + click_button "Continue" + + expect(page).to have_content("Which physics courses do you teach?") + check "A or AS level physics" click_button "Continue" expect(page).to have_content("FE teaching courses goes here") diff --git a/spec/features/further_education_payments/ineligible_paths_spec.rb b/spec/features/further_education_payments/ineligible_paths_spec.rb index d33d1e76e7..bccaff0c29 100644 --- a/spec/features/further_education_payments/ineligible_paths_spec.rb +++ b/spec/features/further_education_payments/ineligible_paths_spec.rb @@ -55,8 +55,49 @@ expect(page).to have_content("You are not eligible for a financial incentive payment yet") end + scenario "when lacking subjects" 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") + 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: college.name + click_button "Continue" + + expect(page).to have_content("Select the college you teach at") + choose college.name + click_button "Continue" + + expect(page).to have_content("What type of contract do you have with #{college.name}?") + choose "Permanent contract" + click_button "Continue" + + expect(page).to have_content("On average, how many hours per week") + choose "More than 12 hours per week" + click_button "Continue" + + expect(page).to have_content("Which academic year did you start teaching in further education (FE) in England?") + choose "September 2023 to August 2024" + click_button "Continue" + + expect(page).to have_content("Which subject areas do you teach?") + check "I do not teach any of these subjects" + click_button "Continue" + + expect(page).to have_content("You are not eligible") + expect(page).to have_content("you must teach an eligible FE subject") + end + scenario "when variable contract and just one academic term taught" 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") @@ -85,6 +126,50 @@ expect(page).to have_content("You are not eligible for a financial incentive payment yet") end + scenario "when teaches non eligible course in applicable subject area" 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") + 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: college.name + click_button "Continue" + + expect(page).to have_content("Select the college you teach at") + choose college.name + click_button "Continue" + + expect(page).to have_content("What type of contract do you have with #{college.name}?") + choose "Permanent contract" + click_button "Continue" + + expect(page).to have_content("On average, how many hours per week") + choose "More than 12 hours per week" + click_button "Continue" + + expect(page).to have_content("Which academic year did you start teaching in further education (FE) in England?") + choose "September 2023 to August 2024" + click_button "Continue" + + expect(page).to have_content("Which subject areas do you teach?") + check "Building and construction" + click_button "Continue" + + expect(page).to have_content("Which building and construction courses do you teach?") + check "I do not teach any of these courses" + click_button "Continue" + + expect(page).to have_content("You are not eligible") + expect(page).to have_content("you must teach an eligible FE course") + end + scenario "when not a recent FE teacher" do when_further_education_payments_journey_configuration_exists @@ -140,22 +225,23 @@ click_button "Continue" expect(page).to have_content("What type of contract do you have with #{college.name}?") - choose("Permanent contract") + 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?") - choose("More than 12 hours per week") + choose "More than 12 hours per week" click_button "Continue" expect(page).to have_content("Which academic year did you start teaching in further education (FE) in England?") - choose("September 2023 to August 2024") + choose "September 2023 to August 2024" click_button "Continue" expect(page).to have_content("Which subject areas do you teach?") - check("Building and construction") + check "Building and construction" click_button "Continue" - expect(page).to have_content("FE building and construction courses goes here") + expect(page).to have_content("Which building and construction courses do you teach?") + check "T Level in onsite construction" click_button "Continue" expect(page).to have_content("FE teaching courses goes here") @@ -203,22 +289,23 @@ click_button "Continue" expect(page).to have_content("What type of contract do you have with #{college.name}?") - choose("Permanent contract") + 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?") - choose("More than 12 hours per week") + choose "More than 12 hours per week" click_button "Continue" expect(page).to have_content("Which academic year did you start teaching in further education (FE) in England?") - choose("September 2023 to August 2024") + choose "September 2023 to August 2024" click_button "Continue" expect(page).to have_content("Which subject areas do you teach?") - check("Building and construction") + check "Building and construction" click_button "Continue" - expect(page).to have_content("FE building and construction courses goes here") + expect(page).to have_content("Which building and construction courses do you teach?") + check "T Level in onsite construction" click_button "Continue" expect(page).to have_content("FE teaching courses goes here") @@ -266,22 +353,23 @@ click_button "Continue" expect(page).to have_content("What type of contract do you have with #{college.name}?") - choose("Permanent contract") + 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?") - choose("More than 12 hours per week") + choose "More than 12 hours per week" click_button "Continue" expect(page).to have_content("Which academic year did you start teaching in further education (FE) in England?") - choose("September 2023 to August 2024") + choose "September 2023 to August 2024" click_button "Continue" expect(page).to have_content("Which subject areas do you teach?") - check("Building and construction") + check "Building and construction" click_button "Continue" - expect(page).to have_content("FE building and construction courses goes here") + expect(page).to have_content("Which building and construction courses do you teach?") + check "T Level in onsite construction" click_button "Continue" expect(page).to have_content("FE teaching courses goes here") @@ -319,7 +407,7 @@ click_button "Continue" expect(page).to have_content("What type of contract do you have with #{college.name}?") - choose("Permanent contract") + 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?") @@ -350,15 +438,15 @@ click_button "Continue" expect(page).to have_content("What type of contract do you have with #{college.name}?") - choose("Fixed-term contract") + choose "Fixed-term contract" click_button "Continue" expect(page).to have_content("Does your fixed-term contract cover the full #{current_academic_year.to_s(:long)} academic year?") - choose("Yes, it covers the full #{current_academic_year.to_s(:long)} academic year") + 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?") - choose("More than 12 hours per week") + 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?") @@ -440,10 +528,11 @@ click_button "Continue" expect(page).to have_content("Which subject areas do you teach?") - check("Building and construction") + check "Building and construction" click_button "Continue" - expect(page).to have_content("FE building and construction courses goes here") + expect(page).to have_content("Which building and construction courses do you teach?") + check "T Level in onsite construction" click_button "Continue" expect(page).to have_content("FE teaching courses goes here") diff --git a/spec/forms/journeys/further_education_payments/building_construction_courses_form_spec.rb b/spec/forms/journeys/further_education_payments/building_construction_courses_form_spec.rb new file mode 100644 index 0000000000..f1fc475eba --- /dev/null +++ b/spec/forms/journeys/further_education_payments/building_construction_courses_form_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Journeys::FurtherEducationPayments::BuildingConstructionCoursesForm, type: :model do + let(:journey) { Journeys::FurtherEducationPayments } + let(:journey_session) { create(:further_education_payments_session) } + let(:building_construction_courses) { [""] } + + let(:params) do + ActionController::Parameters.new( + claim: { + building_construction_courses: + } + ) + end + + subject do + described_class.new( + journey_session:, + journey:, + params: + ) + end + + describe "validations" do + context "when no option selected" do + it do + is_expected.not_to( + allow_value([""]) + .for(:building_construction_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + + context "when non-existent injection option selected" do + it do + is_expected.not_to( + allow_value(["foo"]) + .for(:building_construction_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + end + + describe "#save" do + let(:building_construction_courses) { ["esfa_buildingconstruction", "tlevel_building"] } + + it "updates the journey session" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.building_construction_courses }.to(building_construction_courses) + ) + end + end +end diff --git a/spec/forms/journeys/further_education_payments/chemistry_courses_form_spec.rb b/spec/forms/journeys/further_education_payments/chemistry_courses_form_spec.rb new file mode 100644 index 0000000000..32c09a230a --- /dev/null +++ b/spec/forms/journeys/further_education_payments/chemistry_courses_form_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Journeys::FurtherEducationPayments::ChemistryCoursesForm, type: :model do + let(:journey) { Journeys::FurtherEducationPayments } + let(:journey_session) { create(:further_education_payments_session) } + let(:chemistry_courses) { [""] } + + let(:params) do + ActionController::Parameters.new( + claim: { + chemistry_courses: + } + ) + end + + subject do + described_class.new( + journey_session:, + journey:, + params: + ) + end + + describe "validations" do + context "when no option selected" do + it do + is_expected.not_to( + allow_value([""]) + .for(:chemistry_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + + context "when non-existent injection option selected" do + it do + is_expected.not_to( + allow_value(["foo"]) + .for(:chemistry_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + end + + describe "#save" do + let(:chemistry_courses) { ["alevel_chemistry", "gcse_chemistry"] } + + it "updates the journey session" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.chemistry_courses }.to(chemistry_courses) + ) + end + end +end diff --git a/spec/forms/journeys/further_education_payments/computing_courses_form_spec.rb b/spec/forms/journeys/further_education_payments/computing_courses_form_spec.rb new file mode 100644 index 0000000000..441cd22d10 --- /dev/null +++ b/spec/forms/journeys/further_education_payments/computing_courses_form_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Journeys::FurtherEducationPayments::ComputingCoursesForm, type: :model do + let(:journey) { Journeys::FurtherEducationPayments } + let(:journey_session) { create(:further_education_payments_session) } + let(:computing_courses) { [""] } + + let(:params) do + ActionController::Parameters.new( + claim: { + computing_courses: + } + ) + end + + subject do + described_class.new( + journey_session:, + journey:, + params: + ) + end + + describe "validations" do + context "when no option selected" do + it do + is_expected.not_to( + allow_value([""]) + .for(:computing_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + + context "when non-existent injection option selected" do + it do + is_expected.not_to( + allow_value(["foo"]) + .for(:computing_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + end + + describe "#save" do + let(:computing_courses) { ["digitalskills_quals", "tlevel_digitalsupport"] } + + it "updates the journey session" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.computing_courses }.to(computing_courses) + ) + end + end +end diff --git a/spec/forms/journeys/further_education_payments/early_years_courses_form_spec.rb b/spec/forms/journeys/further_education_payments/early_years_courses_form_spec.rb new file mode 100644 index 0000000000..6a20f65c70 --- /dev/null +++ b/spec/forms/journeys/further_education_payments/early_years_courses_form_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Journeys::FurtherEducationPayments::EarlyYearsCoursesForm, type: :model do + let(:journey) { Journeys::FurtherEducationPayments } + let(:journey_session) { create(:further_education_payments_session) } + let(:early_years_courses) { [""] } + + let(:params) do + ActionController::Parameters.new( + claim: { + early_years_courses: + } + ) + end + + subject do + described_class.new( + journey_session:, + journey:, + params: + ) + end + + describe "validations" do + context "when no option selected" do + it do + is_expected.not_to( + allow_value([""]) + .for(:early_years_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + + context "when non-existent injection option selected" do + it do + is_expected.not_to( + allow_value(["foo"]) + .for(:early_years_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + end + + describe "#save" do + let(:early_years_courses) { ["eylevel2", "eylevel3"] } + + it "updates the journey session" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.early_years_courses }.to(early_years_courses) + ) + end + end +end diff --git a/spec/forms/journeys/further_education_payments/engineering_manufacturing_courses_form_spec.rb b/spec/forms/journeys/further_education_payments/engineering_manufacturing_courses_form_spec.rb new file mode 100644 index 0000000000..2fd862376a --- /dev/null +++ b/spec/forms/journeys/further_education_payments/engineering_manufacturing_courses_form_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Journeys::FurtherEducationPayments::EngineeringManufacturingCoursesForm, type: :model do + let(:journey) { Journeys::FurtherEducationPayments } + let(:journey_session) { create(:further_education_payments_session) } + let(:engineering_manufacturing_courses) { [""] } + + let(:params) do + ActionController::Parameters.new( + claim: { + engineering_manufacturing_courses: + } + ) + end + + subject do + described_class.new( + journey_session:, + journey:, + params: + ) + end + + describe "validations" do + context "when no option selected" do + it do + is_expected.not_to( + allow_value([""]) + .for(:engineering_manufacturing_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + + context "when non-existent injection option selected" do + it do + is_expected.not_to( + allow_value(["foo"]) + .for(:engineering_manufacturing_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + end + + describe "#save" do + let(:engineering_manufacturing_courses) { ["esfa_engineering", "esfa_manufacturing"] } + + it "updates the journey session" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.engineering_manufacturing_courses }.to(engineering_manufacturing_courses) + ) + end + end +end diff --git a/spec/forms/journeys/further_education_payments/maths_courses_form_spec.rb b/spec/forms/journeys/further_education_payments/maths_courses_form_spec.rb new file mode 100644 index 0000000000..f427b4f8c3 --- /dev/null +++ b/spec/forms/journeys/further_education_payments/maths_courses_form_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Journeys::FurtherEducationPayments::MathsCoursesForm, type: :model do + let(:journey) { Journeys::FurtherEducationPayments } + let(:journey_session) { create(:further_education_payments_session) } + let(:maths_courses) { [""] } + + let(:params) do + ActionController::Parameters.new( + claim: { + maths_courses: + } + ) + end + + subject do + described_class.new( + journey_session:, + journey:, + params: + ) + end + + describe "validations" do + context "when no option selected" do + it do + is_expected.not_to( + allow_value([""]) + .for(:maths_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + + context "when non-existent injection option selected" do + it do + is_expected.not_to( + allow_value(["foo"]) + .for(:maths_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + end + + describe "#save" do + let(:maths_courses) { ["gcse_maths"] } + + it "updates the journey session" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.maths_courses }.to(maths_courses) + ) + end + end +end diff --git a/spec/forms/journeys/further_education_payments/physics_courses_form_spec.rb b/spec/forms/journeys/further_education_payments/physics_courses_form_spec.rb new file mode 100644 index 0000000000..3b9bc198ab --- /dev/null +++ b/spec/forms/journeys/further_education_payments/physics_courses_form_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Journeys::FurtherEducationPayments::PhysicsCoursesForm, type: :model do + let(:journey) { Journeys::FurtherEducationPayments } + let(:journey_session) { create(:further_education_payments_session) } + let(:physics_courses) { [""] } + + let(:params) do + ActionController::Parameters.new( + claim: { + physics_courses: + } + ) + end + + subject do + described_class.new( + journey_session:, + journey:, + params: + ) + end + + describe "validations" do + context "when no option selected" do + it do + is_expected.not_to( + allow_value([""]) + .for(:physics_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + + context "when non-existent injection option selected" do + it do + is_expected.not_to( + allow_value(["foo"]) + .for(:physics_courses) + .with_message("Select all the courses you teach otherwise select you do not teach any of these courses") + ) + end + end + end + + describe "#save" do + let(:physics_courses) { ["alevel_physics", "gcse_physics"] } + + it "updates the journey session" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.physics_courses }.to(physics_courses) + ) + end + end +end diff --git a/spec/forms/journeys/further_education_payments/subjects_taught_form_spec.rb b/spec/forms/journeys/further_education_payments/subjects_taught_form_spec.rb index 22f5c75266..355d60dca5 100644 --- a/spec/forms/journeys/further_education_payments/subjects_taught_form_spec.rb +++ b/spec/forms/journeys/further_education_payments/subjects_taught_form_spec.rb @@ -2,7 +2,9 @@ RSpec.describe Journeys::FurtherEducationPayments::SubjectsTaughtForm, type: :model do let(:journey) { Journeys::FurtherEducationPayments } - let(:journey_session) { create(:further_education_payments_session) } + let(:journey_session) { create(:further_education_payments_session, answers:) } + let(:answers) { build(:further_education_payments_answers, answers_hash) } + let(:answers_hash) { {} } let(:subjects_taught) { [] } let(:params) do @@ -48,12 +50,70 @@ end describe "#save" do - let(:subjects_taught) { ["chemistry", "mathematics"] } + let(:subjects_taught) { ["chemistry", "maths"] } it "updates the journey session" do expect { expect(subject.save).to be(true) }.to( - change { journey_session.reload.answers.subjects_taught }.to(["chemistry", "mathematics"]) + change { journey_session.reload.answers.subjects_taught }.to(["chemistry", "maths"]) ) end + + context "when changing some answers" do + let(:answers_hash) do + { + subjects_taught: %w[maths physics], + maths_courses: %w[esfa], + physics_courses: %w[alevel_physics] + } + end + + let(:subjects_taught) { %w[chemistry maths] } + + it "resets dependent answers" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.subjects_taught }.to(subjects_taught) + .and(change { journey_session.reload.answers.physics_courses }.to([]) + .and(not_change { journey_session.reload.answers.maths_courses })) + ) + end + end + + context "when changing all answers" do + let(:answers_hash) do + { + subjects_taught: %w[ + building_construction + chemistry + computing + early_years + engineering_manufacturing + maths + physics + ], + building_construction_courses: %w[none], + chemistry_courses: %w[none], + computing_courses: %w[none], + early_years_courses: %w[none], + engineering_manufacturing_courses: %w[none], + maths_courses: %w[none], + physics_courses: %w[none] + } + end + + let(:subjects_taught) { %w[none] } + + it "resets dependent answers" do + expect { expect(subject.save).to be(true) }.to( + change { journey_session.reload.answers.subjects_taught }.to(subjects_taught) + .and(change { journey_session.reload.answers.building_construction_courses }.to([]) + .and(change { journey_session.reload.answers.chemistry_courses }.to([]) + .and(change { journey_session.reload.answers.computing_courses }.to([]) + .and(change { journey_session.reload.answers.early_years_courses }.to([]) + .and(change { journey_session.reload.answers.engineering_manufacturing_courses }.to([]) + .and(change { journey_session.reload.answers.maths_courses }.to([]) + .and(change { journey_session.reload.answers.physics_courses }.to([])))))))) + ) + end + end end end diff --git a/spec/models/journeys/further_education_payments/answers_presenter_spec.rb b/spec/models/journeys/further_education_payments/answers_presenter_spec.rb index 892202376c..86dfcfa0e0 100644 --- a/spec/models/journeys/further_education_payments/answers_presenter_spec.rb +++ b/spec/models/journeys/further_education_payments/answers_presenter_spec.rb @@ -14,7 +14,7 @@ let(:contract_type) { "permanent" } let(:teaching_hours_per_week) { "more_than_12" } let(:further_education_teaching_start_year) { 2023 } - let(:subjects_taught) { ["chemistry", "mathematics"] } + let(:subjects_taught) { ["chemistry", "maths"] } let(:half_teaching_hours) { true } let(:teaching_qualification) { "yes" } let(:subject_to_formal_performance_action) { false } @@ -44,7 +44,7 @@ ["What type of contract do you have with #{college.name}?", "Permanent contract", "contract-type"], ["On average, how many hours per week are you timetabled to teach at #{college.name} during the current term?", "More than 12 hours per week", "teaching-hours-per-week"], ["Which academic year did you start teaching in further education (FE) in England?", "September 2023 to August 2024", "further-education-teaching-start-year"], - ["Which subject areas do you teach?", "Chemistry
Mathematics
", "subjects-taught"], + ["Which subject areas do you teach?", "Chemistry
Maths
", "subjects-taught"], ["Are at least half of your timetabled teaching hours spent teaching 16 to 19-year-olds, including those up to age 25 with an Education, Health and Care Plan (EHCP)?", "Yes", "half-teaching-hours"], ["Do you have a teaching qualification?", "Yes", "teaching-qualification"], ["Have any performance measures been started against you?", "No", "poor-performance"], @@ -66,7 +66,7 @@ end context "subjects-taught - just one" do - let(:subjects_taught) { %w[building_and_construction] } + let(:subjects_taught) { %w[building_construction] } it { is_expected.to include([ @@ -78,12 +78,12 @@ end context "subjects-taught - all of them" do - let(:subjects_taught) { %w[building_and_construction chemistry computing early_years engineering_and_manufacturing mathematics physics] } + let(:subjects_taught) { %w[building_construction chemistry computing early_years engineering_manufacturing maths physics] } it { is_expected.to include([ "Which subject areas do you teach?", - "Building and construction
Chemistry
Computing, including digital and ICT
Early years
Engineering and manufacturing, including transport engineering and electronics
Mathematics
Physics
", + "Building and construction
Chemistry
Computing, including digital and ICT
Early years
Engineering and manufacturing, including transport engineering and electronics
Maths
Physics
", "subjects-taught" ]) } 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 5b93b7917e..99c90d21d3 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 @@ -25,11 +25,39 @@ build(:further_education_payments_answers, taught_at_least_one_term: false) end - it "is ineligble as :lack_teaching_responsibilities" do + it "is ineligble as :must_teach_at_least_one_term" do expect(subject).to be_ineligible expect(subject.status).to eql(:ineligible) expect(subject.ineligibility_reason).to eql(:must_teach_at_least_one_term) end end + + context "when ineligible as lacking subjects taught" do + let(:answers) do + build(:further_education_payments_answers, subjects_taught: ["none"]) + end + + it "is ineligble as :subject" do + expect(subject).to be_ineligible + expect(subject.status).to eql(:ineligible) + expect(subject.ineligibility_reason).to eql(:subject) + end + end + + context "when all courses are ineligible" do + let(:answers) do + build( + :further_education_payments_answers, + subjects_taught: ["building_construction"], + building_construction_courses: ["none"] + ) + 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(:courses) + end + end end end