From 2dbac37a70c4bd05665004c2a54f54f21e6bd51c Mon Sep 17 00:00:00 2001
From: Thomas Leese
diff --git a/app/views/shared/application_form/_work_history_old_regs_summary.html.erb b/app/views/shared/application_form/_work_history_old_regulations_summary.html.erb
similarity index 100%
rename from app/views/shared/application_form/_work_history_old_regs_summary.html.erb
rename to app/views/shared/application_form/_work_history_old_regulations_summary.html.erb
diff --git a/app/views/teacher_interface/application_forms/show/_draft.html.erb b/app/views/teacher_interface/application_forms/show/_draft.html.erb
index 48729b4fba..60b91073db 100644
--- a/app/views/teacher_interface/application_forms/show/_draft.html.erb
+++ b/app/views/teacher_interface/application_forms/show/_draft.html.erb
@@ -40,13 +40,11 @@
You have completed <%= view_object.completed_task_list_sections.count %> of <%= view_object.task_list_sections.count %> sections.
- You started this application on <%= view_object.started_at %>. - Applications must be completed within 6 months, so you’ll need to complete it before <%= view_object.expires_at %>. -
- <% end %> +<%= govuk_inset_text do %> ++ You started this application on <%= view_object.started_at %>. + Applications must be completed within 6 months, so you’ll need to complete it before <%= view_object.expires_at %>. +
<% end %> <%= render TaskList::Component.new(view_object.task_list_sections) %> diff --git a/spec/factories/application_forms.rb b/spec/factories/application_forms.rb index 0e4e29ab96..48fbb1e592 100644 --- a/spec/factories/application_forms.rb +++ b/spec/factories/application_forms.rb @@ -211,7 +211,7 @@ withdrawn_at { Time.zone.now } end - trait :old_regs do + trait :old_regulations do created_at { Date.new(2023, 1, 31) } needs_work_history do (region.status_check_none? || region.sanction_check_none?) && diff --git a/spec/jobs/expire_requestable_job_spec.rb b/spec/jobs/expire_requestable_job_spec.rb index 7780be08cc..28ce70ff0e 100644 --- a/spec/jobs/expire_requestable_job_spec.rb +++ b/spec/jobs/expire_requestable_job_spec.rb @@ -47,7 +47,7 @@ context "when the applicant is from a country with a 4 week expiry" do let(:application_form) do - create(:application_form, :submitted, :old_regs, region:) + create(:application_form, :submitted, :old_regulations, region:) end # Australia, Canada, Gibraltar, New Zealand, US diff --git a/spec/lib/application_form_section_status_updater_spec.rb b/spec/lib/application_form_section_status_updater_spec.rb index d3cdb393a3..80a4cc9349 100644 --- a/spec/lib/application_form_section_status_updater_spec.rb +++ b/spec/lib/application_form_section_status_updater_spec.rb @@ -255,13 +255,13 @@ context "under the old regulations" do context "with unknown work history" do - let(:application_form) { create(:application_form, :old_regs) } + let(:application_form) { create(:application_form, :old_regulations) } it { is_expected.to eq("not_started") } end context "with no work history" do let(:application_form) do - create(:application_form, :old_regs, has_work_history: false) + create(:application_form, :old_regulations, has_work_history: false) end it { is_expected.to eq("completed") } end @@ -269,7 +269,11 @@ context "with has work history" do context "without work history" do let(:application_form) do - create(:application_form, :old_regs, has_work_history: true) + create( + :application_form, + :old_regulations, + has_work_history: true, + ) end it { is_expected.to eq("in_progress") } end @@ -278,7 +282,7 @@ let(:application_form) do create( :application_form, - :old_regs, + :old_regulations, has_work_history: true, ).tap do |application_form| create(:work_history, application_form:) @@ -291,7 +295,7 @@ let(:application_form) do create( :application_form, - :old_regs, + :old_regulations, has_work_history: true, ).tap do |application_form| create(:work_history, :completed, application_form:) diff --git a/spec/lib/assessment_factory_spec.rb b/spec/lib/assessment_factory_spec.rb index ae6b3105e6..e8a63e1369 100644 --- a/spec/lib/assessment_factory_spec.rb +++ b/spec/lib/assessment_factory_spec.rb @@ -7,7 +7,6 @@ let(:application_form) do create( :application_form, - :old_regs, region: create(:region, country:), needs_work_history: false, needs_written_statement: false, @@ -35,8 +34,8 @@ describe "sections" do subject(:sections) { call.sections } - it "creates three sections" do - expect(sections.count).to eq(3) + it "creates four sections" do + expect(sections.count).to eq(4) end describe "personal information section" do @@ -84,92 +83,48 @@ expect(sections.qualifications.count).to eq(1) end - context "under the old regulations" do - it "has the right checks and failure reasons" do - section = sections.qualifications.first - - expect(section.checks).to eq( - %w[ - qualifications_meet_level_6_or_equivalent - teaching_qualifications_completed_in_eligible_country - qualified_in_mainstream_education - has_teacher_qualification_certificate - has_teacher_qualification_transcript - has_university_degree_certificate - has_university_degree_transcript - has_additional_qualification_certificate - has_additional_degree_transcript - ], - ) - - expect(section.failure_reasons).to eq( - %w[ - application_and_qualification_names_do_not_match - teaching_qualifications_from_ineligible_country - teaching_qualifications_not_at_required_level - teaching_hours_not_fulfilled - not_qualified_to_teach_mainstream - qualifications_dont_match_subjects - qualifications_dont_match_other_details - teaching_certificate_illegible - teaching_transcript_illegible - degree_certificate_illegible - degree_transcript_illegible - additional_degree_certificate_illegible - additional_degree_transcript_illegible - ], - ) - end - - context "when secondary education teaching qualification is required" do - let(:country) { create(:country, :subject_limited) } - - it "has the right checks and failure reasons" do - section = sections.qualifications.first + it "has the right checks and failure reasons" do + section = sections.qualifications.first - expect(section.checks).to eq( - %w[ - qualifications_meet_level_6_or_equivalent - teaching_qualifications_completed_in_eligible_country - qualified_in_mainstream_education - qualified_to_teach_children_11_to_16 - teaching_qualification_subjects_criteria - has_teacher_qualification_certificate - has_teacher_qualification_transcript - has_university_degree_certificate - has_university_degree_transcript - has_additional_qualification_certificate - has_additional_degree_transcript - ], - ) + expect(section.checks).to eq( + %w[ + qualifications_meet_level_6_or_equivalent + teaching_qualifications_completed_in_eligible_country + qualified_in_mainstream_education + has_teacher_qualification_certificate + has_teacher_qualification_transcript + has_university_degree_certificate + has_university_degree_transcript + has_additional_qualification_certificate + has_additional_degree_transcript + teaching_qualification_pedagogy + teaching_qualification_1_year + ], + ) - expect(section.failure_reasons).to eq( - %w[ - application_and_qualification_names_do_not_match - teaching_qualifications_from_ineligible_country - teaching_qualifications_not_at_required_level - teaching_hours_not_fulfilled - not_qualified_to_teach_mainstream - qualifications_dont_match_subjects - qualifications_dont_match_other_details - qualified_to_teach_children_11_to_16 - teaching_qualification_subjects_criteria - teaching_certificate_illegible - teaching_transcript_illegible - degree_certificate_illegible - degree_transcript_illegible - additional_degree_certificate_illegible - additional_degree_transcript_illegible - ], - ) - end - end + expect(section.failure_reasons).to eq( + %w[ + application_and_qualification_names_do_not_match + teaching_qualifications_from_ineligible_country + teaching_qualifications_not_at_required_level + teaching_hours_not_fulfilled + teaching_qualification_pedagogy + teaching_qualification_1_year + not_qualified_to_teach_mainstream + qualifications_dont_match_subjects + qualifications_dont_match_other_details + teaching_certificate_illegible + teaching_transcript_illegible + degree_certificate_illegible + degree_transcript_illegible + additional_degree_certificate_illegible + additional_degree_transcript_illegible + ], + ) end - context "under the new regulations" do - let(:application_form) do - create(:application_form, region: create(:region, country:)) - end + context "when secondary education teaching qualification is required" do + let(:country) { create(:country, :subject_limited) } it "has the right checks and failure reasons" do section = sections.qualifications.first @@ -179,6 +134,8 @@ qualifications_meet_level_6_or_equivalent teaching_qualifications_completed_in_eligible_country qualified_in_mainstream_education + qualified_to_teach_children_11_to_16 + teaching_qualification_subjects_criteria has_teacher_qualification_certificate has_teacher_qualification_transcript has_university_degree_certificate @@ -201,6 +158,8 @@ not_qualified_to_teach_mainstream qualifications_dont_match_subjects qualifications_dont_match_other_details + qualified_to_teach_children_11_to_16 + teaching_qualification_subjects_criteria teaching_certificate_illegible teaching_transcript_illegible degree_certificate_illegible @@ -210,54 +169,6 @@ ], ) end - - context "when secondary education teaching qualification is required" do - let(:country) { create(:country, :subject_limited) } - - it "has the right checks and failure reasons" do - section = sections.qualifications.first - - expect(section.checks).to eq( - %w[ - qualifications_meet_level_6_or_equivalent - teaching_qualifications_completed_in_eligible_country - qualified_in_mainstream_education - qualified_to_teach_children_11_to_16 - teaching_qualification_subjects_criteria - has_teacher_qualification_certificate - has_teacher_qualification_transcript - has_university_degree_certificate - has_university_degree_transcript - has_additional_qualification_certificate - has_additional_degree_transcript - teaching_qualification_pedagogy - teaching_qualification_1_year - ], - ) - - expect(section.failure_reasons).to eq( - %w[ - application_and_qualification_names_do_not_match - teaching_qualifications_from_ineligible_country - teaching_qualifications_not_at_required_level - teaching_hours_not_fulfilled - teaching_qualification_pedagogy - teaching_qualification_1_year - not_qualified_to_teach_mainstream - qualifications_dont_match_subjects - qualifications_dont_match_other_details - qualified_to_teach_children_11_to_16 - teaching_qualification_subjects_criteria - teaching_certificate_illegible - teaching_transcript_illegible - degree_certificate_illegible - degree_transcript_illegible - additional_degree_certificate_illegible - additional_degree_transcript_illegible - ], - ) - end - end end end @@ -356,30 +267,13 @@ expect(sections.work_history.count).to eq(0) end - context "when application form form needs work history" do + context "when an application requires work history" do before { application_form.needs_work_history = true } it "is created" do expect(sections.work_history.count).to eq(1) end - it "has the right checks and failure reasons" do - section = sections.work_history.first - expect(section.checks).to eq( - %w[ - email_contact_current_employer - satisfactory_evidence_work_history - ], - ) - expect(section.failure_reasons).to eq( - ["satisfactory_evidence_work_history"], - ) - end - end - - context "with a new regulations application form" do - let(:application_form) { create(:application_form) } - it "has the right checks and failure reasons" do section = sections.work_history.first @@ -401,7 +295,7 @@ describe "professional standing section" do it "is not created" do - expect(sections.work_history.count).to eq(0) + expect(sections.professional_standing.count).to eq(0) end context "when application form needs a written statement and work history" do diff --git a/spec/lib/dqt/recognition_route_spec.rb b/spec/lib/dqt/recognition_route_spec.rb index aae77eb27f..2fd36816b1 100644 --- a/spec/lib/dqt/recognition_route_spec.rb +++ b/spec/lib/dqt/recognition_route_spec.rb @@ -5,10 +5,10 @@ RSpec.describe DQT::RecognitionRoute do describe "#for_code" do subject(:recognition_route) do - described_class.for_country_code(country_code, under_new_regulations:) + described_class.for_country_code(country_code, under_old_regulations:) end - let(:under_new_regulations) { false } + let(:under_old_regulations) { nil } context "with Scotland" do let(:country_code) { "GB-SCT" } @@ -21,7 +21,7 @@ end context "under the new regulations" do - let(:under_new_regulations) { true } + let(:under_old_regulations) { false } (Country::CODES - %w[GB-SCT GB-NIR]).each do |country_code| context "with #{country_code}" do @@ -32,7 +32,7 @@ end context "under the old regulations" do - let(:under_new_regulations) { false } + let(:under_old_regulations) { true } Country::CODES_IN_EUROPEAN_ECONOMIC_AREA.each do |country_code| context "with #{country_code}" do diff --git a/spec/lib/dqt/trn_request_params_spec.rb b/spec/lib/dqt/trn_request_params_spec.rb index c219abd363..a4f829252d 100644 --- a/spec/lib/dqt/trn_request_params_spec.rb +++ b/spec/lib/dqt/trn_request_params_spec.rb @@ -11,8 +11,8 @@ :application_form, :awarded, teacher:, - created_at: Date.new(2020, 1, 1), - submitted_at: Date.new(2020, 1, 1), + created_at: Date.new(2024, 1, 1), + submitted_at: Date.new(2024, 1, 1), region: create(:region, :in_country, country_code: "AU"), date_of_birth: Date.new(1960, 1, 1), given_names: "Given", @@ -25,11 +25,12 @@ create( :assessment, :award, - recommended_at: Date.new(2020, 1, 7), + recommended_at: Date.new(2024, 1, 7), application_form:, age_range_min: 7, age_range_max: 11, subjects: %w[physics french_language], + induction_required: true, ) end @@ -57,7 +58,7 @@ emailAddress: "teacher@example.com", firstName: "Given", genderCode: "NotAvailable", - inductionRequired: false, + inductionRequired: true, initialTeacherTraining: { ageRangeFrom: 7, ageRangeTo: 11, @@ -71,7 +72,7 @@ }, lastName: "Family", middleName: nil, - qtsDate: "2020-01-01", + qtsDate: "2024-01-07", qualification: { class: "NotKnown", countryCode: "FR", @@ -81,39 +82,9 @@ }, recognitionRoute: "OverseasTrainedTeachers", teacherType: "OverseasQualifiedTeacher", - underNewOverseasRegulations: false, + underNewOverseasRegulations: true, }, ) end - - context "with a new regulations application form" do - around do |example| - ClimateControl.modify(NEW_REGS_DATE: "2020-01-01") { example.run } - end - - it "should use the assessment recommendation date" do - expect(call[:qtsDate]).to eq("2020-01-07") - end - - it "sends the new regulations field" do - expect(call[:underNewOverseasRegulations]).to be true - end - - describe "induction required" do - subject(:induction_required) { call[:inductionRequired] } - - it { is_expected.to be_nil } - - context "when induction is required" do - before { assessment.update!(induction_required: true) } - it { is_expected.to be true } - end - - context "when induction is not required" do - before { assessment.update!(induction_required: false) } - it { is_expected.to be false } - end - end - end end end diff --git a/spec/models/application_form_spec.rb b/spec/models/application_form_spec.rb index ff66525d02..47275addf6 100644 --- a/spec/models/application_form_spec.rb +++ b/spec/models/application_form_spec.rb @@ -444,45 +444,23 @@ it { is_expected.to eq(application_form.reference) } end - describe "#created_under_new_regulations?" do - subject(:created_under_new_regulations?) do - application_form.created_under_new_regulations? + describe "#created_under_old_regulations?" do + subject(:created_under_old_regulations?) do + application_form.created_under_old_regulations? end - context "with default new regulations date" do - context "with an old application form" do - let(:application_form) do - create(:application_form, created_at: Date.new(2020, 1, 1)) - end - it { is_expected.to be false } - end - - context "with a new application form" do - let(:application_form) do - create(:application_form, created_at: Date.new(2024, 1, 1)) - end - it { is_expected.to be true } + context "with an old application form" do + let(:application_form) do + create(:application_form, created_at: Date.new(2020, 1, 1)) end + it { is_expected.to be true } end - context "with a custom new regulations date" do - around do |example| - ClimateControl.modify(NEW_REGS_DATE: "2023-01-01") { example.run } - end - - context "with an old application form" do - let(:application_form) do - create(:application_form, created_at: Date.new(2021, 12, 31)) - end - it { is_expected.to be false } - end - - context "with a new application form" do - let(:application_form) do - create(:application_form, created_at: Date.new(2023, 1, 1)) - end - it { is_expected.to be true } + context "with a new application form" do + let(:application_form) do + create(:application_form, created_at: Date.new(2024, 1, 1)) end + it { is_expected.to be false } end end end diff --git a/spec/models/assessment_spec.rb b/spec/models/assessment_spec.rb index 5682b15822..7468f4218b 100644 --- a/spec/models/assessment_spec.rb +++ b/spec/models/assessment_spec.rb @@ -72,7 +72,7 @@ subject(:can_award?) { assessment.can_award? } context "with an application under old regulations" do - let(:application_form) { create(:application_form, :old_regs) } + let(:application_form) { create(:application_form, :old_regulations) } context "with an unknown assessment" do before do @@ -353,7 +353,7 @@ end context "with an application under old regulations" do - let(:application_form) { create(:application_form, :old_regs) } + let(:application_form) { create(:application_form, :old_regulations) } it { is_expected.to be false } end end @@ -428,7 +428,7 @@ end context "with an application under old regulations" do - let(:application_form) { create(:application_form, :old_regs) } + let(:application_form) { create(:application_form, :old_regulations) } it { is_expected.to be false } end end diff --git a/spec/services/send_reminder_email_spec.rb b/spec/services/send_reminder_email_spec.rb index 053b0da8f8..fe59a70abd 100644 --- a/spec/services/send_reminder_email_spec.rb +++ b/spec/services/send_reminder_email_spec.rb @@ -215,7 +215,7 @@ context "with a requested FI request" do let(:application_form) do - create(:application_form, :submitted, :old_regs, region:) + create(:application_form, :submitted, :old_regulations, region:) end let(:assessment) { create(:assessment, application_form:) } let(:region) { create(:region, :in_country, country_code: "FR") } @@ -284,9 +284,7 @@ end context "with a requested reference request" do - let(:application_form) do - create(:application_form, :submitted, :old_regs, region:) - end + let(:application_form) { create(:application_form, :submitted, region:) } let(:assessment) { create(:assessment, application_form:) } let(:region) { create(:region, :in_country, country_code: "FR") } let(:work_history) { remindable.work_history } diff --git a/spec/support/autoload/page_objects/assessor_interface/check_work_history.rb b/spec/support/autoload/page_objects/assessor_interface/check_work_history.rb index c140e958a2..7fe22ccce7 100644 --- a/spec/support/autoload/page_objects/assessor_interface/check_work_history.rb +++ b/spec/support/autoload/page_objects/assessor_interface/check_work_history.rb @@ -16,7 +16,7 @@ class CheckWorkHistory < AssessmentSection ".govuk-checkboxes__conditional .govuk-checkboxes__item" def most_recent_role - cards&.second + cards&.first end end end diff --git a/spec/system/assessor_interface/checking_submitted_details_spec.rb b/spec/system/assessor_interface/checking_submitted_details_spec.rb index 52695c9932..48d2c00244 100644 --- a/spec/system/assessor_interface/checking_submitted_details_spec.rb +++ b/spec/system/assessor_interface/checking_submitted_details_spec.rb @@ -460,7 +460,6 @@ def application_form application_form = create( :application_form, - :old_regs, :with_teaching_qualification, :with_work_history, :with_registration_number, diff --git a/spec/system/assessor_interface/completing_assessment_spec.rb b/spec/system/assessor_interface/completing_assessment_spec.rb index 5c1b7a8ec6..592e0f61e9 100644 --- a/spec/system/assessor_interface/completing_assessment_spec.rb +++ b/spec/system/assessor_interface/completing_assessment_spec.rb @@ -9,7 +9,7 @@ it "award" do given_i_am_authorized_as_an_assessor_user - given_there_is_an_awardable_application_form(%i[old_regs]) + given_there_is_an_awardable_application_form(%i[old_regulations]) given_i_can_request_dqt_api when_i_visit_the(