-
Notifications
You must be signed in to change notification settings - Fork 4
Allow checked mailer recipients to also include bcc and cc emails #5
Conversation
lib/action_mailer_matchers.rb
Outdated
@@ -17,7 +17,7 @@ module ActionMailerMatchers | |||
|
|||
def matching_mail_for(email, body, email_subject) | |||
deliveries.detect do |mail| | |||
has_expected_email = mail.to.include?(email) | |||
has_expected_email = mail.destinations.include?(email) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about having more explicit expectations around this? I'm imagining something like this. Would this result in any false positives where we meant to send someone as the main to
but instead sent it as bcc
?
expect(user).to have_received_email(subject: "Subject")
expect(user).to have_received_cc_email(subject: "Subject")
expect(user).to have_received_bcc_email(subject: "Subject")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that approach, it's specifies the user email and the method that the email should be sent. I'll code it up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updates look great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding a small update to the usage section explaining that there are two additional methods? https://github.com/contently/action_mailer_matchers#usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
09aa68e
to
8ce60f3
Compare
Added examples to the README and squashed ⛄️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome addition, thank you!!! 🚢 I'm not sure if we have to do anything to cut a new version in rubygems?
8ce60f3
to
c6842f7
Compare
I had one more change that I messed up with rebasing that I just force pushed (the I think we'll have to follow the steps in this guide to publish a new version. Did you originally push the gem to rubygems? I don't have write permissions on this repo too, so I can't merge this PR |
- Change checked recipients from only the mailer's `.to` recipient, to all recipients (`.bcc`, `.cc`) - Add new helper methods `have_received_bcc_email` and `have_received_cc_email`
c6842f7
to
d0f7231
Compare
One more force push to correct commit message |
Thanks! I tested locally too, will merge and cut a new version. |
We've run into a few instances where we'd like to check the bcc and cc emails
.to
recipient, to also check other recipients (.bcc
,.cc
)have_received_bcc_email
andhave_received_cc_email