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.
This commit is contained in:
Maikel Linke
2023-05-29 13:25:44 +10:00
parent fff02a7ddb
commit 3fa62ceccf

View File

@@ -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