From 718b2df8f5fa93f9e1474b0d85838510fcfc255d Mon Sep 17 00:00:00 2001 From: ulferts Date: Wed, 15 Sep 2021 18:07:35 +0200 Subject: [PATCH] mock the delayed_job backend --- spec/features/notifications/reminder_mail_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/features/notifications/reminder_mail_spec.rb b/spec/features/notifications/reminder_mail_spec.rb index 037e556e0a..74e0625d5b 100644 --- a/spec/features/notifications/reminder_mail_spec.rb +++ b/spec/features/notifications/reminder_mail_spec.rb @@ -106,6 +106,12 @@ describe "Reminder email", type: :feature, js: true do involved_work_package ActiveJob::Base.queue_adapter.enqueued_jobs.clear + + # There is no delayed_job associated when using the testing backend of ActiveJob + # so we have to mock it. + allow(Notifications::ScheduleReminderMailsJob) + .to receive(:delayed_job) + .and_return(instance_double(Delayed::Backend::ActiveRecord::Job, run_at: Time.current.utc)) end it 'sends a digest mail based on the configuration', with_settings: { journal_aggregation_time_minutes: 0 } do