diff options
author | Nick Thomas <nick@gitlab.com> | 2016-08-16 19:08:43 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-08-16 19:08:43 +0300 |
commit | 0e9c4a902d7985d917fac1f833c9544133f83a95 (patch) | |
tree | aaca0b1902216b3d43973bf562d7d3eb01b1edb4 /spec/support/email_helpers.rb | |
parent | b62954db4c40df435363994ce4632632fde01455 (diff) |
DRY up the added update service specs, add two email helpers
Diffstat (limited to 'spec/support/email_helpers.rb')
-rw-r--r-- | spec/support/email_helpers.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/support/email_helpers.rb b/spec/support/email_helpers.rb index a85ab22ce36..0bfc4685532 100644 --- a/spec/support/email_helpers.rb +++ b/spec/support/email_helpers.rb @@ -3,6 +3,16 @@ module EmailHelpers ActionMailer::Base.deliveries.map(&:to).flatten.count(user.email) == 1 end + def reset_delivered_emails! + ActionMailer::Base.deliveries.clear + end + + def should_only_email(*users) + users.each {|user| should_email(user) } + recipients = ActionMailer::Base.deliveries.flat_map(&:to) + expect(recipients.count).to eq(users.count) + end + def should_email(user) expect(sent_to_user?(user)).to be_truthy end |