Skip to content
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

SL add rspec matcher #145

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

synion
Copy link

@synion synion commented Feb 17, 2022

The reason to add new matcher for RSpec was that I assumed that we can check a few assertions using only one matcher.
Also returned fails was hard to read.

Example of use:

mail = MandrillMailer.deliveries.last

expect(mail).to be_mandrill_email(
  template_name: 'user-registered-for-event',
  to: 'user@mail.com'
)

 expect(MandrillMailer.deliveries).to include(
   mandrill_email(
     template_name: 'user-registered-for-event',
     to: 'first_user@test.com'
   ),
   mandrill_email(
     template_name: 'send-invitation-to-user',
     to: 'joe@doe.com'
   ),
   mandrill_email(
     template_name: 'send-invitation-to-user',
     to: 'rejected@user.com'
   ),
   mandrill_email(
     template_name: 'send-invitation-and-paid',
     to: 'simon@templar.com'
   ),
 )
expect(mailer).to be_mandrill_email(
 template_name: 'user-registered-for-event',
 to: 'joe@doe.example',
 global_variables: {
   'FNAME' => 'John',
   'START_TIME' => '10:45am EST / 7:45am PST',
   'VENUE' => 'Midtown Venue',
   'START_DATE' => 'Wednesday, 01/10/2018',
   'NEXT_EVENT_DATE' => nil,
   'MEMBER_FULL_NAME' => 'John Gates',
   'MEMBER_EMAIL' => 'joe@doe.example'
 }
)

Returning info could look like that:
Screenshot 2022-02-17 at 07 05 44

@wwahammy
Copy link

wwahammy commented Nov 8, 2023

This is awesome @synion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants