-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure TDA defauls are handled when change the qualification
When changing from non TDA to TDA course: Make sure full time is set on site statuses When changing from TDA to non TDA course: Make sure A level is clear
- Loading branch information
1 parent
ffd59fa
commit a0862ee
Showing
5 changed files
with
119 additions
and
20 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
spec/controllers/publish/courses/outcome_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe Publish::Courses::OutcomeController do | ||
let(:recruitment_cycle) { create(:recruitment_cycle, year: 2025) } | ||
let(:user) { create(:user, providers: [build(:provider, recruitment_cycle:)]) } | ||
let(:provider) { user.providers.first } | ||
|
||
before do | ||
allow(controller).to receive(:authenticate).and_return(true) | ||
controller.instance_variable_set(:@current_user, user) | ||
allow(Settings.features).to receive(:teacher_degree_apprenticeship).and_return(true) | ||
end | ||
|
||
describe '#update' do | ||
context 'when changing from a QTS to teacher degree apprenticeship course' do | ||
it 'assigns teacher degree apprenticeship course defaults' do | ||
course = create( | ||
:course, | ||
:resulting_in_qts, | ||
provider:, | ||
study_mode: :part_time, | ||
site_statuses: [build(:site_status, :part_time_vacancies, :findable)] | ||
) | ||
create(:course_enrichment, :initial_draft, course_length: :TwoYears, course:) | ||
|
||
put :update, params: { | ||
course: { qualification: 'undergraduate_degree_with_qts' }, | ||
provider_code: provider.provider_code, | ||
recruitment_cycle_year: provider.recruitment_cycle_year, | ||
code: course.course_code | ||
} | ||
|
||
course.reload | ||
|
||
expect(course.funding_type).to eq('apprenticeship') | ||
expect(course.can_sponsor_skilled_worker_visa).to be(false) | ||
expect(course.can_sponsor_student_visa).to be(false) | ||
expect(course.additional_degree_subject_requirements).to be(false) | ||
expect(course.degree_subject_requirements).to be_nil | ||
expect(course.degree_grade).to eq('not_required') | ||
expect(course.study_mode).to eq('full_time') | ||
expect(course.site_statuses.map(&:vac_status).uniq.first).to eq('full_time_vacancies') | ||
expect(course.enrichments.max_by(&:created_at).course_length).to eq('4 years') | ||
end | ||
end | ||
|
||
context 'when changing from teacher degree apprenticeship to a QTS course' do | ||
it 'clear teacher degree specific defaults' do | ||
course = create( | ||
:course, | ||
:with_teacher_degree_apprenticeship, | ||
:resulting_in_undergraduate_degree_with_qts, | ||
:with_a_level_requirements, | ||
provider: | ||
) | ||
|
||
put :update, params: { | ||
course: { qualification: 'qts' }, | ||
provider_code: provider.provider_code, | ||
recruitment_cycle_year: provider.recruitment_cycle_year, | ||
code: course.course_code | ||
} | ||
|
||
course.reload | ||
|
||
expect(course.a_level_subject_requirements).to eq([]) | ||
expect(course.accept_a_level_equivalency).to be_nil | ||
expect(course.accept_pending_a_level).to be_nil | ||
expect(course.additional_a_level_equivalencies).to be_nil | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters