From c423b5e9712fef2ff8019ba6f143b142a735dfbe Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Tue, 11 Jun 2024 12:55:33 +0100 Subject: [PATCH] Add age and subject restriction content This adds some content for countries which have an age and subject restriction, shown on both the qualifications form and the eligibility checker "proof of qualifications" section. Currently this content is included in the teaching qualifications content in the support console which will need to be removed as this gets deployed. --- ...eaching_qualification_information.html.erb | 42 +++++++++++++++-- .../teacher_interface/qualifications_spec.rb | 47 +++++++++++++++---- 2 files changed, 76 insertions(+), 13 deletions(-) diff --git a/app/views/shared/_teaching_qualification_information.html.erb b/app/views/shared/_teaching_qualification_information.html.erb index b94a3fc6d8..1c9cd485e9 100644 --- a/app/views/shared/_teaching_qualification_information.html.erb +++ b/app/views/shared/_teaching_qualification_information.html.erb @@ -1,7 +1,41 @@ -<% if region.teaching_qualification_information.present? %> - <%= raw GovukMarkdown.render(region.teaching_qualification_information) %> +<% country = region.country %> +<% region_information = region.teaching_qualification_information %> +<% country_information = country.teaching_qualification_information %> + +<% if region_information.present? || country_information.present? %> +

Qualification criteria for <%= CountryName.from_country(country, with_definite_article: true) %>

+ + <% if region_information.present? %> + <%= raw GovukMarkdown.render(region_information) %> + <% end %> + + <% if country_information.present? %> + <%= raw GovukMarkdown.render(country_information) %> + <% end %> <% end %> -<% if region.country.teaching_qualification_information.present? %> - <%= raw GovukMarkdown.render(region.country.teaching_qualification_information) %> +<% if country.subject_limited %> +

Age and subject restrictions

+ +

+ We only accept applications from teachers from <%= CountryName.from_country(country, with_definite_article: true) %> who are qualified to teach children aged 11-16 in one or more of the following specific subjects: +

+ +

+ Maths, Science, Biology, Chemistry, Physics, French, German, Italian, Japanese, Latin, Mandarin, Russian, Spanish. +

+ +

+ We do not accept related subjects, for example economics instead of maths, agricultural science instead of biology or engineering instead of physics. +

+ +

Qualified means:

+ + + +

We accept any of the above as evidence you are qualified to teach a specific subject.

<% end %> diff --git a/spec/system/teacher_interface/qualifications_spec.rb b/spec/system/teacher_interface/qualifications_spec.rb index a07320d506..5264970094 100644 --- a/spec/system/teacher_interface/qualifications_spec.rb +++ b/spec/system/teacher_interface/qualifications_spec.rb @@ -3,12 +3,10 @@ require "rails_helper" RSpec.describe "Teacher qualifications", type: :system do - before do - given_i_am_authorized_as_a_user(teacher) - given_an_application_form_exists - end + before { given_i_am_authorized_as_a_user(teacher) } it "records qualifications" do + given_an_application_form_exists given_malware_scanning_is_enabled when_i_visit_the(:teacher_application_page) @@ -17,6 +15,7 @@ when_i_click_the_qualifications_task then_i_see_the(:teacher_new_qualification_page) + and_i_dont_see_the_age_subject_restrictions when_i_fill_in_the_qualification_information then_i_see_the(:teacher_upload_document_page) @@ -45,6 +44,7 @@ end it "deletes qualifications" do + given_an_application_form_exists given_malware_scanning_is_disabled given_some_qualifications_exist @@ -64,6 +64,19 @@ and_i_see_two_qualifications end + it "subject restricted countries" do + given_the_country_is_subject_limited + given_an_application_form_exists + + when_i_visit_the(:teacher_application_page) + then_i_see_the(:teacher_application_page) + and_i_see_the_qualifications_task + + when_i_click_the_qualifications_task + then_i_see_the(:teacher_new_qualification_page) + and_i_see_the_age_subject_restrictions + end + private def given_an_application_form_exists @@ -80,6 +93,10 @@ def given_some_qualifications_exist ApplicationFormSectionStatusUpdater.call(application_form:) end + def given_the_country_is_subject_limited + @country = create(:country, :subject_limited) + end + def and_i_see_the_qualifications_task expect(teacher_application_page.qualifications_task_item).to_not be_nil end @@ -88,6 +105,18 @@ def when_i_click_the_qualifications_task teacher_application_page.qualifications_task_item.click end + def and_i_see_the_age_subject_restrictions + expect(teacher_new_qualification_page).to have_content( + "Age and subject restrictions", + ) + end + + def and_i_dont_see_the_age_subject_restrictions + expect(teacher_new_qualification_page).to_not have_content( + "Age and subject restrictions", + ) + end + def when_i_fill_in_the_qualification_information teacher_new_qualification_page.form.title_field.fill_in with: "BSc Teaching" teacher_new_qualification_page.form.institution_name_field.fill_in with: @@ -207,12 +236,12 @@ def teacher @teacher ||= create(:teacher) end + def country + @country ||= create(:country, code: "FR") + end + def application_form @application_form ||= - create( - :application_form, - region: create(:region, :in_country, country_code: "FR"), - teacher:, - ) + create(:application_form, region: create(:region, country:), teacher:) end end