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
57258566
Commit
57258566
authored
Sep 19, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use EmailHelpers where possible, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6342#note_15434860
parent
d39b1959
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+2
-3
email_helpers.rb
spec/support/email_helpers.rb
+5
-1
No files found.
spec/models/ci/pipeline_spec.rb
View file @
57258566
...
...
@@ -535,14 +535,13 @@ describe Ci::Pipeline, models: true do
shared_examples
'sending a notification'
do
it
'sends an email'
do
sent_to
=
ActionMailer
::
Base
.
deliveries
.
flat_map
(
&
:to
)
expect
(
sent_to
).
to
contain_exactly
(
pipeline
.
user
.
email
)
should_only_email
(
pipeline
.
user
)
end
end
shared_examples
'not sending any notification'
do
it
'does not send any email'
do
expect
(
ActionMailer
::
Base
.
deliveries
).
to
be_empty
should_email_no_one
end
end
...
...
spec/support/email_helpers.rb
View file @
57258566
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
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