summaryrefslogtreecommitdiff
path: root/spec/support/email_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/email_helpers.rb')
-rw-r--r--spec/support/email_helpers.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/email_helpers.rb b/spec/support/email_helpers.rb
new file mode 100644
index 00000000000..a85ab22ce36
--- /dev/null
+++ b/spec/support/email_helpers.rb
@@ -0,0 +1,13 @@
+module EmailHelpers
+ def sent_to_user?(user)
+ ActionMailer::Base.deliveries.map(&:to).flatten.count(user.email) == 1
+ end
+
+ def should_email(user)
+ expect(sent_to_user?(user)).to be_truthy
+ end
+
+ def should_not_email(user)
+ expect(sent_to_user?(user)).to be_falsey
+ end
+end