mirror of https://github.com/rails/rails
315db730cc
The current example test for jobs using `perform_now` to run the job inline. This is problematic for jobs that have retries configured, as any exception that is retried will be silently rescued. Ideally, the test will still fail because the job did not perform the work it was supposed to, but it makes finding the root cause a lot harder. Testing with `perform_enqueued_jobs` and `perform_later` gets around this problem, as the retries are also performed immediately and, assuming that the exception happens consistently, it will bubble up after exhausting its retries. Therefore, this PR updates the basic test guidance to suggest `perform_enqueued_jobs` and `perform_later` over `perform_now`. Both described behaviours make it harder to test that a job raises a specific exception, so this requires special handling, which I added a paragraph on. I can pull that out to a separate PR if desired. |
||
---|---|---|
.. | ||
assets | ||
bug_report_templates | ||
rails_guides | ||
source | ||
.document | ||
.rubocop.yml | ||
CHANGELOG.md | ||
Rakefile | ||
rails_guides.rb | ||
w3c_validator.rb |