mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user