Fix ActionMailer assertion not working for mail defining delivery_job:#34339
Merged
rafaelfranca merged 2 commits intorails:masterfrom Nov 21, 2018
Merged
Fix ActionMailer assertion not working for mail defining delivery_job:#34339rafaelfranca merged 2 commits intorails:masterfrom
rafaelfranca merged 2 commits intorails:masterfrom
Conversation
|
r? @schneems (@rails-bot has picked a reviewer for you, use r? to override) |
e301872 to
9a8c609
Compare
9a8c609 to
10529a9
Compare
kamipo
reviewed
Oct 29, 2018
gmcgibbon
reviewed
Oct 29, 2018
f2410bb to
375841d
Compare
- That feature is useful to enqueue or assert that jobs got enqueued or performed based on dynamic conditions. We will be able to leverage that feature to fix all ActionMailer assertion helper issue when a Mailer define a custom delivery job (see next commit).
375841d to
d813837
Compare
Member
Author
|
Sorry for the delay, this is ready with a new implementation |
- If a Mail defines a custom delivery_job, all ActionMailer assertion
helper (assert_emails, assert_enqueued_emails ...) wouldn't work.
```ruby
MyMailer < ApplicationMailer
self.delivery_job = MyJob
end
# This assertion will fail
assert_emails(1) do
MyMailer.my_mail.deliver_later
end
This PR leverage the new ActiveJob feature that accepts Procs for the
`only` keyword and check if the delivery job is one of ActionMailer
registered ones.
d813837 to
e139a3c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix ActionMailer assertion not working for mail defining delivery_job:
helper (assert_emails, assert_enqueued_emails ...) wouldn't work.
This PR leverage the new ActiveJob feature that accepts Procs for the
onlykeyword and check if the delivery job is one of ActionMailerregistered ones.