From 3fa62ceccfbbb61be69fafa36c3390a419423063 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 29 May 2023 13:25:44 +1000 Subject: [PATCH] Simplify background report spec after rspec fix The rspec-rails gem had an issue which was fixed in the last release. Now we can remove my workaround and simplify the spec. --- spec/jobs/report_job_spec.rb | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/spec/jobs/report_job_spec.rb b/spec/jobs/report_job_spec.rb index 5c748b5609..b66d4a33f2 100644 --- a/spec/jobs/report_job_spec.rb +++ b/spec/jobs/report_job_spec.rb @@ -29,16 +29,12 @@ describe ReportJob do end it "triggers an email when the report is done" do - # Setup test data which also triggers emails: - report_args - # Send emails for quick jobs as well: stub_const("ReportJob::NOTIFICATION_TIME", 0) + ReportJob.perform_later(*report_args) + expect { - # We need to create this job within the block because of a bug in - # rspec-rails: https://github.com/rspec/rspec-rails/issues/2668 - ReportJob.perform_later(*report_args) perform_enqueued_jobs(only: ReportJob) }.to enqueue_mail(ReportMailer, :report_ready).with( params: { @@ -50,13 +46,9 @@ describe ReportJob do end it "triggers no email when the report is done quickly" do - # Setup test data which also triggers emails: - report_args + ReportJob.perform_later(*report_args) expect { - # We need to create this job within the block because of a bug in - # rspec-rails: https://github.com/rspec/rspec-rails/issues/2668 - ReportJob.perform_later(*report_args) perform_enqueued_jobs(only: ReportJob) }.to_not enqueue_mail end