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 a495af1 commit 2e6cbbb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 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 false unless CycleTimetable.current_year >= 2025

super
end

def lacks_admin_users?
courses.any? &&
!(provider_permissions.exists?(manage_users: true) &&
Expand Down
16 changes: 16 additions & 0 deletions spec/models/provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,20 @@
expect(described_class.with_courses).to eq([provider])
end
end

describe '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).not_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
end

0 comments on commit 2e6cbbb

Please sign in to comment.