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 9416059
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 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
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 9416059

Please sign in to comment.