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
04afdb61
Commit
04afdb61
authored
Oct 08, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve spec for merge when build succeeds feature
parent
f5631ff2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb
.../merge_requests/merge_when_build_succeeds_service_spec.rb
+19
-5
No files found.
spec/services/merge_requests/merge_when_build_succeeds_service_spec.rb
View file @
04afdb61
...
@@ -110,9 +110,21 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
...
@@ -110,9 +110,21 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
context
'properly handles multiple stages'
do
context
'properly handles multiple stages'
do
let
(
:ref
)
{
mr_merge_if_green_enabled
.
source_branch
}
let
(
:ref
)
{
mr_merge_if_green_enabled
.
source_branch
}
let!
(
:build
)
{
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
ref:
ref
,
name:
'build'
,
stage:
'build'
)
}
let
(
:sha
)
{
project
.
commit
(
ref
).
id
}
let!
(
:test
)
{
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
ref:
ref
,
name:
'test'
,
stage:
'test'
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
ref:
mr_merge_if_green_enabled
.
source_branch
,
project:
project
)
}
let
(
:pipeline
)
do
create
(
:ci_empty_pipeline
,
ref:
ref
,
sha:
sha
,
project:
project
)
end
let!
(
:build
)
do
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
ref:
ref
,
name:
'build'
,
stage:
'build'
)
end
let!
(
:test
)
do
create
(
:ci_build
,
:created
,
pipeline:
pipeline
,
ref:
ref
,
name:
'test'
,
stage:
'test'
)
end
before
do
before
do
# This behavior of MergeRequest: we instantiate a new object
# This behavior of MergeRequest: we instantiate a new object
...
@@ -121,14 +133,16 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
...
@@ -121,14 +133,16 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
end
end
end
end
it
"doesn't merge if
some
stages failed"
do
it
"doesn't merge if
any of
stages failed"
do
expect
(
MergeWorker
).
not_to
receive
(
:perform_async
)
expect
(
MergeWorker
).
not_to
receive
(
:perform_async
)
build
.
success
build
.
success
test
.
drop
test
.
drop
end
end
it
'merge when all stages succeeded'
do
it
'merge
s
when all stages succeeded'
do
expect
(
MergeWorker
).
to
receive
(
:perform_async
)
expect
(
MergeWorker
).
to
receive
(
:perform_async
)
build
.
success
build
.
success
test
.
success
test
.
success
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