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

Add have_sent(number).emails matcher #1

Open
aaackerman opened this issue Aug 15, 2016 · 4 comments
Open

Add have_sent(number).emails matcher #1

aaackerman opened this issue Aug 15, 2016 · 4 comments

Comments

@aaackerman
Copy link
Contributor

Add a matcher to check how many emails that have been sent as a result of an action.

@sophiedeziel
Copy link

I think it would be a good idea to have an interface similar to Rspec Mocks. They are like this:

expect(...).to receive(...).once
expect(...).to receive(...).twice
expect(...).to receive(...).exactly(n).times
expect(...).to receive(...).at_least(:once)
expect(...).to receive(...).at_least(:twice)
expect(...).to receive(...).at_least(n).times
expect(...).to receive(...).at_most(:once)
expect(...).to receive(...).at_most(:twice)
expect(...).to receive(...).at_most(n).times

Maybe something that looks like:

expect {...}.to have_sent(n).email
expect {...}.to have_sent.exactly(n).emails
expect {...}.to have_sent.at_least(:one).email
expect {...}.to have_sent.at_least(:two).emails
expect {...}.to have_sent.at_least(n).emails
expect {...}.to have_sent.at_most(:one).email
expect {...}.to have_sent.at_most(:two).emails
expect {...}.to have_sent.at_most(n).emails

@aaackerman
Copy link
Contributor Author

Great suggestion, @sophiedeziel! I'll take a look at implementing one or two of those examples over the weekend. If you're interested in contributing too, please do! PRs are always welcome. 🎉

@sophiedeziel
Copy link

Yes, I'd love to open a pull request for that! I wanted to discuss that interface with you first. I'll see if I have time to implement something today or tomorrow.

@aaackerman
Copy link
Contributor Author

Awesome! Looking forward to discussing it further with you.

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

No branches or pull requests

2 participants