-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perform email jobs in #assert_emails #32231
Perform email jobs in #assert_emails #32231
Conversation
Perform enqueued delivery jobs in #assert_emails and #assert_no_emails.
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @sgrif (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review. Please see the contribution instructions for more information. |
…_emails Perform email jobs in #assert_emails
- Remove extra execution of `perform_enqueued_jobs` since it performs all enqueued jobs in the duration of the block. - Fix example of using `assert_emails` without block since we can't use enqueued jobs in this case.
Hey, @gmcgibbon, do you know what commit made this change necessary? Rails 5 pushes to |
@DylanReile That's probably related to the queue adapter you have configured for your app's test environment. The default one (async) doesn't performa jobs right away. |
@gmcgibbon We're on |
Generating a new app on Rails 5 and looking at the git history I don't see |
Summary
Currently,
ActionMailer
's test helpers for asserting emails do not perform enqueued mail jobs. With this change, code like:can be shortened to:
Are there any strong feelings against this change? What would be a scenario where this would not be wanted?