From af34e304b2292d14c913168236a4b7765a38ec65 Mon Sep 17 00:00:00 2001 From: Iain McNulty Date: Thu, 29 Aug 2024 10:44:02 +0100 Subject: [PATCH] Defer Provider#selectable_school? until 2025 recruitment cycle --- app/models/provider.rb | 6 ++++ .../course_study_mode_step_spec.rb | 2 +- ...ch_course_are_you_applying_to_step_spec.rb | 2 +- spec/models/provider_spec.rb | 34 +++++++++++++++++++ ...iple_sites_and_unselectable_school_spec.rb | 2 +- ...odes_sites_and_unselectable_school_spec.rb | 2 +- 6 files changed, 44 insertions(+), 4 deletions(-) diff --git a/app/models/provider.rb b/app/models/provider.rb index f1ddc9ee092..f2a665cce41 100644 --- a/app/models/provider.rb +++ b/app/models/provider.rb @@ -62,6 +62,12 @@ def onboarded? provider_agreements.any? end + def selectable_school? + return true unless CycleTimetable.current_year >= 2025 + + super + end + def lacks_admin_users? courses.any? && !(provider_permissions.exists?(manage_users: true) && diff --git a/spec/forms/candidate_interface/course_selection/course_study_mode_step_spec.rb b/spec/forms/candidate_interface/course_selection/course_study_mode_step_spec.rb index dd7d08029ba..11338754a7f 100644 --- a/spec/forms/candidate_interface/course_selection/course_study_mode_step_spec.rb +++ b/spec/forms/candidate_interface/course_selection/course_study_mode_step_spec.rb @@ -42,7 +42,7 @@ end end - context 'when course has multiple sites and provider school is not selectable' do + context 'when course has multiple sites and provider school is not selectable', time: CycleTimetableHelper.mid_cycle(2025) do let(:provider) { create(:provider, selectable_school: false) } before do diff --git a/spec/forms/candidate_interface/course_selection/which_course_are_you_applying_to_step_spec.rb b/spec/forms/candidate_interface/course_selection/which_course_are_you_applying_to_step_spec.rb index 2b4645579b1..9bc6e8c6894 100644 --- a/spec/forms/candidate_interface/course_selection/which_course_are_you_applying_to_step_spec.rb +++ b/spec/forms/candidate_interface/course_selection/which_course_are_you_applying_to_step_spec.rb @@ -163,7 +163,7 @@ end end - context 'when course has multiple sites and provider school is not selectable' do + context 'when course has multiple sites and provider school is not selectable', time: CycleTimetableHelper.mid_cycle(2025) do let(:provider) { create(:provider, selectable_school: false) } before do diff --git a/spec/models/provider_spec.rb b/spec/models/provider_spec.rb index 0acbff9f841..0ceed5f2b12 100644 --- a/spec/models/provider_spec.rb +++ b/spec/models/provider_spec.rb @@ -54,4 +54,38 @@ expect(described_class.with_courses).to eq([provider]) end end + + describe 'selectable_school?' do + context 'provider is selectable_school' do + let(:provider) { create(:provider, selectable_school: true) } + + context 'when Current Cycle is 2024', time: mid_cycle(2024) do + it 'is not selectable school' do + expect(provider).to be_selectable_school + end + end + + context 'when Current Cycle is greater than 2024', time: mid_cycle(2025) do + it 'is selectable school' do + expect(provider).to be_selectable_school + end + end + end + + context 'provider is not selectable_school' do + let(:provider) { create(:provider, selectable_school: false) } + + context 'when Current Cycle is 2024', time: mid_cycle(2024) do + it 'is not selectable school' do + expect(provider).to be_selectable_school + end + end + + context 'when Current Cycle is greater than 2024', time: mid_cycle(2025) do + it 'is not selectable school' do + expect(provider).not_to be_selectable_school + end + end + end + end end diff --git a/spec/system/candidate_interface/course_selection/candidate_selecting_a_course_with_multiple_sites_and_unselectable_school_spec.rb b/spec/system/candidate_interface/course_selection/candidate_selecting_a_course_with_multiple_sites_and_unselectable_school_spec.rb index 432fd841e11..4621f8646cb 100644 --- a/spec/system/candidate_interface/course_selection/candidate_selecting_a_course_with_multiple_sites_and_unselectable_school_spec.rb +++ b/spec/system/candidate_interface/course_selection/candidate_selecting_a_course_with_multiple_sites_and_unselectable_school_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -RSpec.describe 'Selecting a course with multiple sites when the provider is not selectable_school' do +RSpec.describe 'Selecting a course with multiple sites when the provider is not selectable_school', time: CycleTimetableHelper.mid_cycle(2025) do include CandidateHelper it 'Candidate skips the school selection' do diff --git a/spec/system/candidate_interface/course_selection/candidate_selecting_a_course_with_multiple_study_modes_sites_and_unselectable_school_spec.rb b/spec/system/candidate_interface/course_selection/candidate_selecting_a_course_with_multiple_study_modes_sites_and_unselectable_school_spec.rb index b44c4ed1450..af42418d503 100644 --- a/spec/system/candidate_interface/course_selection/candidate_selecting_a_course_with_multiple_study_modes_sites_and_unselectable_school_spec.rb +++ b/spec/system/candidate_interface/course_selection/candidate_selecting_a_course_with_multiple_study_modes_sites_and_unselectable_school_spec.rb @@ -3,7 +3,7 @@ RSpec.describe 'Selecting a course with multiple study modes and sites when the provider is not selectable_school' do include CandidateHelper - it 'Candidate skips the school selection' do + it 'Candidate skips the school selection', time: CycleTimetableHelper.mid_cycle(2025) do given_i_am_signed_in and_there_are_course_options