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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
accaf7ea
Commit
accaf7ea
authored
Aug 18, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make create pipeline service specs more readable
parent
8fadba44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
+27
-11
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+27
-11
No files found.
spec/services/ci/create_pipeline_service_spec.rb
View file @
accaf7ea
...
...
@@ -55,10 +55,15 @@ describe Ci::CreatePipelineService do
context
'when merge requests already exist for this source branch'
do
it
'updates head pipeline of each merge request'
do
merge_request_1
=
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
"branch_1"
,
source_project:
project
)
merge_request_2
=
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
"branch_2"
,
source_project:
project
)
merge_request_1
=
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
"branch_1"
,
source_project:
project
)
head_pipeline
=
pipeline
merge_request_2
=
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
"branch_2"
,
source_project:
project
)
head_pipeline
=
execute_service
expect
(
merge_request_1
.
reload
.
head_pipeline
).
to
eq
(
head_pipeline
)
expect
(
merge_request_2
.
reload
.
head_pipeline
).
to
eq
(
head_pipeline
)
...
...
@@ -66,9 +71,11 @@ describe Ci::CreatePipelineService do
context
'when there is no pipeline for source branch'
do
it
"does not update merge request head pipeline"
do
merge_request
=
create
(
:merge_request
,
source_branch:
'feature'
,
target_branch:
"branch_1"
,
source_project:
project
)
merge_request
=
create
(
:merge_request
,
source_branch:
'feature'
,
target_branch:
"branch_1"
,
source_project:
project
)
head_pipeline
=
pipelin
e
head_pipeline
=
execute_servic
e
expect
(
merge_request
.
reload
.
head_pipeline
).
not_to
eq
(
head_pipeline
)
end
...
...
@@ -76,13 +83,19 @@ describe Ci::CreatePipelineService do
context
'when merge request target project is different from source project'
do
let!
(
:target_project
)
{
create
(
:project
,
:repository
)
}
let!
(
:forked_project_link
)
{
create
(
:forked_project_link
,
forked_to_project:
project
,
forked_from_project:
target_project
)
}
let!
(
:forked_project_link
)
do
create
(
:forked_project_link
,
forked_to_project:
project
,
forked_from_project:
target_project
)
end
it
'updates head pipeline for merge request'
do
merge_request
=
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
"branch_1"
,
source_project:
project
,
target_project:
target_project
)
merge_request
=
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
"branch_1"
,
source_project:
project
,
target_project:
target_project
)
head_pipeline
=
pipelin
e
head_pipeline
=
execute_servic
e
expect
(
merge_request
.
reload
.
head_pipeline
).
to
eq
(
head_pipeline
)
end
...
...
@@ -90,9 +103,12 @@ describe Ci::CreatePipelineService do
context
'when the pipeline is not the latest for the branch'
do
it
'does not update merge request head pipeline'
do
merge_request
=
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
"branch_1"
,
source_project:
project
)
merge_request
=
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
"branch_1"
,
source_project:
project
)
allow_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:latest?
).
and_return
(
false
)
allow_any_instance_of
(
Ci
::
Pipeline
)
.
to
receive
(
:latest?
).
and_return
(
false
)
pipeline
...
...
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