summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-09-19 13:54:16 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-10-17 07:25:20 +0000
commit572585665f838584b9547831528f26fb60df8d0f (patch)
treec69248b468ec846aa0b2ab74e58dcb4e7494e878 /spec/support
parentd39b1959d80f857e57fe67696c8d4525cb5966d9 (diff)
downloadgitlab-ce-572585665f838584b9547831528f26fb60df8d0f.tar.gz
Use EmailHelpers where possible, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6342#note_15434860
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/email_helpers.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/spec/support/email_helpers.rb b/spec/support/email_helpers.rb
index 0bfc4685532..dfb252544e7 100644
--- a/spec/support/email_helpers.rb
+++ b/spec/support/email_helpers.rb
@@ -1,6 +1,6 @@
module EmailHelpers
def sent_to_user?(user)
- ActionMailer::Base.deliveries.map(&:to).flatten.count(user.email) == 1
+ ActionMailer::Base.deliveries.flat_map(&:to).count(user.email) == 1
end
def reset_delivered_emails!
@@ -20,4 +20,8 @@ module EmailHelpers
def should_not_email(user)
expect(sent_to_user?(user)).to be_falsey
end
+
+ def should_email_no_one
+ expect(ActionMailer::Base.deliveries).to be_empty
+ end
end