BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
beb47c25
Commit
beb47c25
authored
Sep 19, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to slightly optimize EmailHeleprs
parent
230bae9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
email_helpers.rb
spec/support/email_helpers.rb
+11
-7
No files found.
spec/support/email_helpers.rb
View file @
beb47c25
module
EmailHelpers
def
sent_to_user?
(
user
)
ActionMailer
::
Base
.
deliveries
.
flat_map
(
&
:to
).
count
(
user
.
email
)
==
1
def
sent_to_user?
(
user
,
recipients
=
nil
)
recipients
||=
ActionMailer
::
Base
.
deliveries
.
flat_map
(
&
:to
)
recipients
.
count
(
user
.
email
)
==
1
end
def
reset_delivered_emails!
...
...
@@ -8,17 +10,19 @@ module EmailHelpers
end
def
should_only_email
(
*
users
)
users
.
each
{
|
user
|
should_email
(
user
)
}
recipients
=
ActionMailer
::
Base
.
deliveries
.
flat_map
(
&
:to
)
users
.
each
{
|
user
|
should_email
(
user
,
recipients
)
}
expect
(
recipients
.
count
).
to
eq
(
users
.
count
)
end
def
should_email
(
user
)
expect
(
sent_to_user?
(
user
)).
to
be_truthy
def
should_email
(
user
,
recipients
=
nil
)
expect
(
sent_to_user?
(
user
,
recipients
)).
to
be_truthy
end
def
should_not_email
(
user
)
expect
(
sent_to_user?
(
user
)).
to
be_falsey
def
should_not_email
(
user
,
recipients
=
nil
)
expect
(
sent_to_user?
(
user
,
recipients
)).
to
be_falsey
end
def
should_email_no_one
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment