Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

adapt background jobs triggering in feature specs

ulferts0866c784dd81
diff --git a/spec/features/admin/working_days_spec.rb b/spec/features/admin/working_days_spec.rb
index f5b216b4e2d..c6526d78d54 100644
--- a/spec/features/admin/working_days_spec.rb
+++ b/spec/features/admin/working_days_spec.rb
@@ -163,9 +163,9 @@ RSpec.describe "Working Days", :js do
TABLE
end
- it "shows an error when a previous change to the working days configuration isn't processed yet" do
+ it "shows an error when a previous change to the working days configuration isn't processed yet",
+ with_good_job_batches: [WorkPackages::ApplyWorkingDaysChangeJob] do
# Have a job already scheduled
- ActiveJob::Base.disable_test_adapter
WorkPackages::ApplyWorkingDaysChangeJob.perform_later(user_id: 5)
uncheck "Tuesday"
diff --git a/spec/features/notifications/reminder_mail_spec.rb b/spec/features/notifications/reminder_mail_spec.rb
index aa7eb9f0aa8..c33648b54c8 100644
--- a/spec/features/notifications/reminder_mail_spec.rb
+++ b/spec/features/notifications/reminder_mail_spec.rb
@@ -1,7 +1,9 @@
require "spec_helper"
require_relative "../users/notifications/shared_examples"
-RSpec.describe "Reminder email sending", js: false do
+RSpec.describe "Reminder email sending",
+ js: false,
+ with_good_job_batches: [Notifications::ScheduleReminderMailsJob] do
let!(:project) { create(:project, members: { receiving_user => role }) }
let!(:mute_project) { create(:project, members: { receiving_user => role }) }
let(:role) { create(:project_role, permissions: %i[view_work_packages]) }
@@ -61,10 +63,6 @@ RSpec.describe "Reminder email sending", js: false do
end
end
- before do
- ActiveJob::Base.disable_test_adapter
- end
-
it "sends a digest mail based on the configuration", with_settings: { journal_aggregation_time_minutes: 0 } do
# Perform some actions the user listens to
User.execute_as other_user do
diff --git a/spec/features/projects/copy_spec.rb b/spec/features/projects/copy_spec.rb
index 80786ce4f98..25bb2031365 100644
--- a/spec/features/projects/copy_spec.rb
+++ b/spec/features/projects/copy_spec.rb
@@ -583,7 +583,6 @@ RSpec.describe "Projects copy", :js,
expect(page).to have_text "The job has been queued and will be processed shortly."
GoodJob.perform_inline
- perform_enqueued_jobs
expect(copied_project)
.to be_present
@@ -599,7 +598,5 @@ RSpec.describe "Projects copy", :js,
# ensure all jobs are run especially emails which might be sent later on
GoodJob.perform_inline
- while perform_enqueued_jobs > 0
- end
end
end
diff --git a/spec/features/projects/template_spec.rb b/spec/features/projects/template_spec.rb
index a0301a0fdc9..fe4d3577f5f 100644
--- a/spec/features/projects/template_spec.rb
+++ b/spec/features/projects/template_spec.rb
@@ -136,7 +136,6 @@ RSpec.describe "Project templates", :js, with_good_job_batches: [CopyProjectJob,
# Run background jobs twice: the background job which itself enqueues the mailer job
GoodJob.perform_inline
- 2.times { perform_enqueued_jobs }
mail = ActionMailer::Base
.deliveries