Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab FOSS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab FOSS
Commits
beb47c25
Commit
beb47c25
authored
8 years ago
by
Lin Jen-Shin
Browse files
Options
Downloads
Patches
Plain Diff
Try to slightly optimize EmailHeleprs
parent
230bae9d
No related branches found
No related tags found
1 merge request
!6342
Integrate CI emails into notification system
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/support/email_helpers.rb
+11
-7
11 additions, 7 deletions
spec/support/email_helpers.rb
with
11 additions
and
7 deletions
spec/support/email_helpers.rb
+
11
−
7
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 @@ def reset_delivered_emails!
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment