Skip to content

Commit

Permalink
Defer Provider#selectable_school? until 2025 recruitment cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
inulty-dfe committed Aug 29, 2024
1 parent c070c04 commit 819b70e
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 4 deletions.
6 changes: 6 additions & 0 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions spec/models/provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 819b70e

Please sign in to comment.