Skip to content

Commit

Permalink
fix flakey test
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Nov 29, 2024
1 parent f9ec57d commit 1c66fb9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions spec/factories/reminders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
full_name { Faker::Name.name }
email_address { Faker::Internet.email }
journey_class { Journeys.all.sample.to_s }

trait :with_additonal_payments_reminder do
journey_class { Journeys::AdditionalPaymentsForTeaching.to_s }
end

trait :with_fe_reminder do
journey_class { Journeys::FurtherEducationPayments.to_s }
end
end
end
10 changes: 5 additions & 5 deletions spec/features/admin/admin_configure_services_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
let(:count) { [*1..5].sample }

before do
create_list(:reminder, count, email_verified: true, itt_academic_year: AcademicYear.current)
create_list(:reminder, count, :with_additonal_payments_reminder, email_verified: true, itt_academic_year: AcademicYear.current)
# should not be included
create(:reminder, email_verified: true, itt_academic_year: AcademicYear.next)
create(:reminder, email_verified: true, itt_academic_year: AcademicYear.current, email_sent_at: Date.today)
create(:reminder, email_verified: false, itt_academic_year: AcademicYear.current)
create(:reminder, :with_fe_reminder, email_verified: true, itt_academic_year: AcademicYear.next)
create(:reminder, :with_fe_reminder, email_verified: true, itt_academic_year: AcademicYear.current, email_sent_at: Date.today)
create(:reminder, :with_fe_reminder, email_verified: false, itt_academic_year: AcademicYear.current)
end

scenario "Service operator opens an ECP service for submissions" do
Expand All @@ -89,7 +89,7 @@

within_fieldset("Service status") { choose("Open") }
expect(page).to have_content(I18n.t("admin.journey_configuration.reminder_warning", count: count))
# make sure email reminder jobjob is queued
# make sure email reminder job is queued
expect { click_on "Save" }.to enqueue_job(SendReminderEmailsJob)
expect(current_path).to eq(admin_journey_configurations_path)

Expand Down

0 comments on commit 1c66fb9

Please sign in to comment.