Skip to content

Commit

Permalink
Travel to current cohort to avoid the new cohort setup pages
Browse files Browse the repository at this point in the history
When registration opens we see different views to the current
cohort. Travel to the time the current cohort opens so we don't
see setup pages.
  • Loading branch information
cwrw committed Jun 5, 2024
1 parent c1b6255 commit 1cfa214
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "rails_helper"

RSpec.feature "ECT doing CIP: no validation", type: :feature do
RSpec.feature "ECT doing CIP: no validation", type: :feature, mid_cohort: true do
let!(:participant_details) do
NewSeeds::Scenarios::Participants::Ects::EctNoValidation
.new(school_cohort:, full_name: participant_full_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "rails_helper"
require_relative "../training_dashboard/manage_training_steps"

RSpec.describe "Manage CIP participants", js: true, with_feature_flags: { eligibility_notifications: "active" } do
RSpec.describe "Manage CIP participants", js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do
include ManageTrainingSteps

before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "rails_helper"
require_relative "../training_dashboard/manage_training_steps"

RSpec.describe "Manage FIP partnered participants with no change of circumstances", js: true, with_feature_flags: { eligibility_notifications: "active" } do
RSpec.describe "Manage FIP partnered participants with no change of circumstances", js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do
include ManageTrainingSteps

context "inactive change of circumstances flag" do
Expand All @@ -14,11 +14,11 @@
RSpec.describe "Manage FIP partnered participants with change of circumstances", js: true, with_feature_flags: { eligibility_notifications: "active" } do
include ManageTrainingSteps

context "active change of circumstances flag" do
context "active change of circumstances flag", mid_cohort: true do
it_behaves_like "manage fip participants example"
end

context "transferring participants" do
context "transferring participants", mid_cohort: true do
before do
given_there_is_a_school_that_has_chosen_fip_for_previous_cohort_and_partnered
and_i_am_signed_in_as_an_induction_coordinator
Expand Down Expand Up @@ -53,15 +53,15 @@
end
end

context "participants that have transferred out" do
context "participants that have transferred out", mid_cohort: true do
before do
given_there_is_a_school_that_has_chosen_fip_and_partnered
and_i_have_a_transferred_out_participant
and_i_am_signed_in_as_an_induction_coordinator
and_i_click(Cohort.current.description)
end

scenario "Induction coordinator can view participants that have completed their transfer out" do
scenario "Induction coordinator can view participants that have completed their transfer out", mid_cohort: true do
given_i_am_taken_to_fip_induction_dashboard
when_i_navigate_to_ect_dashboard
when_i_filter_by("No longer training (1)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "rails_helper"
require_relative "../training_dashboard/manage_training_steps"

RSpec.describe "Manage FIP unpartnered participants", js: true, with_feature_flags: { eligibility_notifications: "active" } do
RSpec.describe "Manage FIP unpartnered participants", js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do
include ManageTrainingSteps

before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "rails_helper"
require_relative "../training_dashboard/manage_training_steps"

RSpec.describe "Manage currently training participants", js: true do
RSpec.describe "Manage currently training participants", js: true, mid_cohort: true do
include ManageTrainingSteps

before do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
set_dqt_validation_result
end

scenario "Induction tutor cannot add existing ECT" do
scenario "Induction tutor cannot add existing ECT", mid_cohort: true do
when_i_navigate_to_ect_dashboard
when_i_click_to_add_a_new_ect
then_i_should_be_on_the_who_to_add_page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "rails_helper"
require_relative "./manage_training_steps"

RSpec.describe "Manage No ECT training", js: true do
RSpec.describe "Manage No ECT training", js: true, mid_cohort: true do
include ManageTrainingSteps

scenario "Manage No ECT Induction Coordinator" do
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/schools/core_programme/materials_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "rails_helper"

RSpec.describe "Schools::CoreProgramme::Materials", type: :request do
RSpec.describe "Schools::CoreProgramme::Materials", type: :request, mid_cohort: true do
let(:user) { create(:user, :induction_coordinator) }
let(:school) { user.induction_coordinator_profile.schools.first }
let!(:cohort) { Cohort.current || create(:cohort, :current) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe "Schools::EarlyCareerTeachers", type: :request, js: true, with_feature_flags: { eligibility_notifications: "active" } do
RSpec.describe "Schools::EarlyCareerTeachers", type: :request, js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do
let(:user) { create(:user, :induction_coordinator, school_ids: [school.id]) }
let!(:lead_provider) { create(:cpd_lead_provider, :with_lead_provider, name: "Lead Provider").lead_provider }

Expand Down
2 changes: 1 addition & 1 deletion spec/requests/schools/mentors_request_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe "Schools::Participants", type: :request, js: true, with_feature_flags: { eligibility_notifications: "active" } do
RSpec.describe "Schools::Participants", type: :request, js: true, with_feature_flags: { eligibility_notifications: "active" }, mid_cohort: true do
let(:user) { create(:user, :induction_coordinator, school_ids: [school.id]) }
let!(:lead_provider) { create(:cpd_lead_provider, :with_lead_provider, name: "Lead Provider").lead_provider }

Expand Down
13 changes: 13 additions & 0 deletions spec/support/cohort_periods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,16 @@ def inside_auto_assignment_window(cohort: Cohort.current, &block)
def outside_auto_assignment_window(cohort: Cohort.current, &block)
travel_to(cohort.automatic_assignment_period_end_date + 1.week, &block)
end

# time travel to after the current cohort opens
RSpec.configure do |config|
config.before(mid_cohort: true) do
travel_to(
Time.zone.local(
Cohort.current.start_year,
Cohort.current.academic_year_start_date.month,
Cohort.current.academic_year_start_date.day + 2,
),
)
end
end

0 comments on commit 1cfa214

Please sign in to comment.