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: '[email protected]'
)

 expect(MandrillMailer.deliveries).to include(
   mandrill_email(
     template_name: 'user-registered-for-event',
     to: '[email protected]'
   ),
   mandrill_email(
     template_name: 'send-invitation-to-user',
     to: '[email protected]'
   ),
   mandrill_email(
     template_name: 'send-invitation-to-user',
     to: '[email protected]'
   ),
   mandrill_email(
     template_name: 'send-invitation-and-paid',
     to: '[email protected]'
   ),
 )
expect(mailer).to be_mandrill_email(
 template_name: 'user-registered-for-event',
 to: '[email protected]',
 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' => '[email protected]'
 }
)

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

@synion synion force-pushed the sl-add-rspec-matcher branch from 1c753e0 to daefc45 Compare February 17, 2022 06:17
@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.

2 participants