Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
345ff6cb
Commit
345ff6cb
authored
Sep 15, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: models/ci/mail_service_spec.rb
parent
d495e4df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
33 deletions
+18
-33
spec/models/ci/mail_service_spec.rb
spec/models/ci/mail_service_spec.rb
+18
-33
No files found.
spec/models/ci/mail_service_spec.rb
View file @
345ff6cb
...
@@ -29,6 +29,11 @@ describe Ci::MailService do
...
@@ -29,6 +29,11 @@ describe Ci::MailService do
describe
'Sends email for'
do
describe
'Sends email for'
do
let
(
:mail
)
{
Ci
::
MailService
.
new
}
let
(
:mail
)
{
Ci
::
MailService
.
new
}
let
(
:deliveries
)
{
ActionMailer
::
Base
.
deliveries
}
before
(
:each
)
do
deliveries
.
clear
end
describe
'failed build'
do
describe
'failed build'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:ci_project
,
email_add_pusher:
true
)
}
let
(
:project
)
{
FactoryGirl
.
create
(
:ci_project
,
email_add_pusher:
true
)
}
...
@@ -42,13 +47,10 @@ describe Ci::MailService do
...
@@ -42,13 +47,10 @@ describe Ci::MailService do
end
end
it
do
it
do
should_email
(
"git@example.com"
)
mail
.
execute
(
build
)
mail
.
execute
(
build
)
end
expect
(
deliveries
.
count
).
to
eq
(
1
)
expect
(
deliveries
[
0
].
subject
).
to
include
(
'Build failed for'
)
def
should_email
(
email
)
expect
(
deliveries
[
0
].
to
).
to
eq
([
"git@example.com"
])
expect
(
Notify
).
to
receive
(
:build_fail_email
).
with
(
build
.
id
,
email
)
expect
(
Notify
).
not_to
receive
(
:build_success_email
).
with
(
build
.
id
,
email
)
end
end
end
end
...
@@ -64,13 +66,10 @@ describe Ci::MailService do
...
@@ -64,13 +66,10 @@ describe Ci::MailService do
end
end
it
do
it
do
should_email
(
"git@example.com"
)
mail
.
execute
(
build
)
mail
.
execute
(
build
)
end
expect
(
deliveries
.
count
).
to
eq
(
1
)
expect
(
deliveries
[
0
].
subject
).
to
include
(
'Build success for'
)
def
should_email
(
email
)
expect
(
deliveries
[
0
].
to
).
to
eq
([
"git@example.com"
])
expect
(
Notify
).
to
receive
(
:build_success_email
).
with
(
build
.
id
,
email
)
expect
(
Notify
).
not_to
receive
(
:build_fail_email
).
with
(
build
.
id
,
email
)
end
end
end
end
...
@@ -91,14 +90,12 @@ describe Ci::MailService do
...
@@ -91,14 +90,12 @@ describe Ci::MailService do
end
end
it
do
it
do
should_email
(
"git@example.com"
)
should_email
(
"jeroen@example.com"
)
mail
.
execute
(
build
)
mail
.
execute
(
build
)
end
expect
(
deliveries
.
count
).
to
eq
(
2
)
expect
(
deliveries
[
0
].
subject
).
to
include
(
'Build success for'
)
def
should_email
(
email
)
expect
(
deliveries
[
0
].
to
).
to
eq
([
"jeroen@example.com"
]
)
expect
(
Notify
).
to
receive
(
:build_success_email
).
with
(
build
.
id
,
email
)
expect
(
deliveries
[
1
].
subject
).
to
include
(
'Build success for'
)
expect
(
Notify
).
not_to
receive
(
:build_fail_email
).
with
(
build
.
id
,
email
)
expect
(
deliveries
[
1
].
to
).
to
eq
([
"git@example.com"
]
)
end
end
end
end
...
@@ -119,14 +116,8 @@ describe Ci::MailService do
...
@@ -119,14 +116,8 @@ describe Ci::MailService do
end
end
it
do
it
do
should_email
(
commit
.
git_author_email
)
should_email
(
"jeroen@example.com"
)
mail
.
execute
(
build
)
if
mail
.
can_execute?
(
build
)
mail
.
execute
(
build
)
if
mail
.
can_execute?
(
build
)
end
expect
(
deliveries
.
count
).
to
eq
(
0
)
def
should_email
(
email
)
expect
(
Notify
).
not_to
receive
(
:build_success_email
).
with
(
build
.
id
,
email
)
expect
(
Notify
).
not_to
receive
(
:build_fail_email
).
with
(
build
.
id
,
email
)
end
end
end
end
...
@@ -170,14 +161,8 @@ describe Ci::MailService do
...
@@ -170,14 +161,8 @@ describe Ci::MailService do
it
do
it
do
Ci
::
Build
.
retry
(
build
)
Ci
::
Build
.
retry
(
build
)
should_email
(
commit
.
git_author_email
)
should_email
(
"jeroen@example.com"
)
mail
.
execute
(
build
)
if
mail
.
can_execute?
(
build
)
mail
.
execute
(
build
)
if
mail
.
can_execute?
(
build
)
end
expect
(
deliveries
.
count
).
to
eq
(
0
)
def
should_email
(
email
)
expect
(
Notify
).
not_to
receive
(
:build_success_email
).
with
(
build
.
id
,
email
)
expect
(
Notify
).
not_to
receive
(
:build_fail_email
).
with
(
build
.
id
,
email
)
end
end
end
end
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