Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2061] Fix tests which will fail when rollover ends (spike) #4384

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cookies:
name: _consented_to_analytics_cookies
expire_after_days: 182

current_recruitment_cycle_year: 2024
current_recruitment_cycle_year: 2025
next_cycle_open_date: 2024-10-1

govuk_notify:
Expand Down
2 changes: 1 addition & 1 deletion spec/components/add_course_button_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def provider_code
end

def recruitment_cycle_year
2024
Settings.current_recruitment_cycle_year
end

def accredited_provider?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
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(:user) { create(:user, providers: [build(:provider)]) }
let(:provider) { user.providers.first }

before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,10 @@
end

def given_i_am_authenticated_as_a_provider_user
recruitment_cycle = create(:recruitment_cycle, year: 2025)
@user = create(:user, providers: [build(:provider, recruitment_cycle:, provider_type: 'lead_school', sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])])
@user = create(:user, providers: [build(:provider, provider_type: 'lead_school', sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])])
@provider = @user.providers.first
create(:provider, :accredited_provider, provider_code: '1BJ')
@accredited_provider = create(:provider, :accredited_provider, provider_code: '1BJ', recruitment_cycle:)
@accredited_provider = create(:provider, :accredited_provider, provider_code: '1BK')
@provider.accrediting_provider_enrichments = []
@provider.accrediting_provider_enrichments << AccreditingProviderEnrichment.new(
{
Expand All @@ -161,7 +160,7 @@ def and_i_have_a_teacher_degree_apprenticeship_course
end

def when_i_visit_the_course_description_tab
publish_provider_courses_show_page.load(provider_code: @provider.provider_code, recruitment_cycle_year: 2025, course_code: @course.course_code)
publish_provider_courses_show_page.load(provider_code: @provider.provider_code, recruitment_cycle_year: @provider.recruitment_cycle_year, course_code: @course.course_code)
end

def then_i_see_a_levels_row
Expand Down
17 changes: 4 additions & 13 deletions spec/features/publish/courses/editing_course_outcome_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

context 'TDA course' do
scenario 'changing the outcome from non TDA to TDA' do
given_i_am_authenticated_as_a_provider_user_in_the_next_cycle
given_i_am_authenticated_as_a_provider_user
and_the_tda_feature_flag_is_active
and_there_is_a_qts_course_i_want_to_edit
when_i_visit_the_course_outcome_page_in_the_next_cycle
Expand All @@ -45,7 +45,7 @@

context 'fee course' do
scenario 'changing the outcome from TDA to non TDA' do
given_i_am_authenticated_as_a_provider_user_in_the_next_cycle
given_i_am_authenticated_as_a_provider_user
and_the_tda_feature_flag_is_active
and_there_is_a_tda_course_i_want_to_edit
when_i_visit_the_course_outcome_page_in_the_next_cycle
Expand All @@ -72,7 +72,7 @@

context 'salaried course' do
scenario 'changing the outcome from TDA to non TDA' do
given_i_am_authenticated_as_a_provider_user_in_the_next_cycle
given_i_am_authenticated_as_a_provider_user
and_the_tda_feature_flag_is_active
and_there_is_a_tda_course_i_want_to_edit
when_i_visit_the_course_outcome_page_in_the_next_cycle
Expand All @@ -88,15 +88,6 @@
end
end

def given_i_am_authenticated_as_a_provider_user_in_the_next_cycle
next_cycle_providers = [build(:provider, :next_recruitment_cycle, :accredited_provider,
courses: [create(:course, :with_accrediting_provider)],
sites: [build(:site), build(:site)],
study_sites: [build(:site, :study_site)])]
@next_cycle_user = create(:user, providers: next_cycle_providers)
given_i_am_authenticated(user: @next_cycle_user)
end

def given_i_am_authenticated_as_a_provider_user
given_i_am_authenticated(user: create(:user, :with_provider))
end
Expand Down Expand Up @@ -148,7 +139,7 @@ def and_the_course_outcome_is_updated
end

def then_i_am_shown_the_correct_qts_options
expect(publish_courses_outcome_edit_page.qualification_names).to contain_exactly('QTS', 'QTS with PGCE', 'PGDE with QTS')
expect(publish_courses_outcome_edit_page.qualification_names).to contain_exactly('QTS', 'QTS with PGCE', 'PGDE with QTS', 'Teacher degree apprenticeship (TDA) with QTS')
end

def then_i_am_shown_the_correct_non_qts_options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def when_i_visit_the_course_details_page
end

def when_i_am_authenticated_as_a_provider_user_with_study_sites
providers = [build(:provider, sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site)], courses: [build(:course, :with_accrediting_provider, applications_open_from: '2023-10-10', start_date: '2023-10-10')])]
providers = [build(:provider, sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site)], courses: [build(:course, :with_accrediting_provider)])]
@user = create(:user, providers:)
given_i_am_authenticated(user: @user)
end
Expand Down
7 changes: 3 additions & 4 deletions spec/features/publish/courses/new_tda_course_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,10 @@
end

def given_i_am_authenticated_as_a_school_direct_provider_user
recruitment_cycle = create(:recruitment_cycle, year: 2025)
@user = create(:user, providers: [build(:provider, recruitment_cycle:, provider_type: 'lead_school', sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])])
@user = create(:user, providers: [build(:provider, provider_type: 'lead_school', sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])])
@provider = @user.providers.first
create(:provider, :accredited_provider, provider_code: '1BJ')
@accredited_provider = create(:provider, :accredited_provider, provider_code: '1BJ', recruitment_cycle:)
@accredited_provider = create(:provider, :accredited_provider, provider_code: '1BK')
@provider.accrediting_provider_enrichments = []
@provider.accrediting_provider_enrichments << AccreditingProviderEnrichment.new(
{
Expand All @@ -240,7 +239,7 @@ def given_i_am_authenticated_as_a_scitt_provider_user
@user = create(
:user,
providers: [
create(:provider, :scitt, recruitment_cycle: build(:recruitment_cycle, year: 2025), sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])
create(:provider, :scitt, sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])
]
)
given_i_am_authenticated(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@
end

def given_i_am_authenticated_as_a_provider_user
recruitment_cycle = create(:recruitment_cycle, year: 2025)
@user = create(:user, providers: [build(:provider, recruitment_cycle:, provider_type: 'lead_school', sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])])
@user = create(:user, providers: [build(:provider, provider_type: 'lead_school', sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])])
@provider = @user.providers.first
create(:provider, :accredited_provider, provider_code: '1BJ')
@accredited_provider = create(:provider, :accredited_provider, provider_code: '1BJ', recruitment_cycle:)
@accredited_provider = create(:provider, :accredited_provider, provider_code: '1BK')
@provider.accrediting_provider_enrichments = []
@provider.accrediting_provider_enrichments << AccreditingProviderEnrichment.new(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
end

def given_i_am_authenticated_as_a_provider_user
recruitment_cycle = create(:recruitment_cycle, year: 2025)
@user = create(:user, providers: [build(:provider, recruitment_cycle:, provider_type: 'lead_school', sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])])
@user = create(:user, providers: [build(:provider, provider_type: 'lead_school', sites: [build(:site), build(:site)], study_sites: [build(:site, :study_site), build(:site, :study_site)])])
@provider = @user.providers.first
create(:provider, :accredited_provider, provider_code: '1BJ')
@accredited_provider = create(:provider, :accredited_provider, provider_code: '1BJ', recruitment_cycle:)
@accredited_provider = create(:provider, :accredited_provider, provider_code: '1BK')
@provider.accrediting_provider_enrichments = []
@provider.accrediting_provider_enrichments << AccreditingProviderEnrichment.new(
{
Expand Down
2 changes: 1 addition & 1 deletion spec/features/publish/viewing_a_course_preview_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def user_with_fee_based_course
:open,
:secondary,
:fee_type_based,
applications_open_from: Time.zone.tomorrow,
applications_open_from: RecruitmentCycle.current.application_start_date,
accrediting_provider:,
site_statuses:, enrichments: [course_enrichment],
study_sites: [study_site],
Expand Down
Loading