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
Jérome Perrin
gitlab-ce
Commits
95662468
Commit
95662468
authored
Apr 24, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify specs and remove unnecessary attributes
parent
14642e3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+3
-11
spec/workers/expire_pipeline_cache_worker_spec.rb
spec/workers/expire_pipeline_cache_worker_spec.rb
+1
-2
No files found.
spec/models/ci/pipeline_spec.rb
View file @
95662468
...
...
@@ -1040,23 +1040,15 @@ describe Ci::Pipeline, models: true do
describe
"#all_merge_requests"
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
'master'
,
sha:
'a288a022a53a5a944fae87bcec6efc87b7061808'
)
}
it
"returns merge request if pipeline runs on `diff_head_sha`"
do
merge_request
=
create
(
:merge_request
,
source_project:
project
,
source_branch:
pipeline
.
ref
)
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:diff_head_sha
)
{
'a288a022a53a5a944fae87bcec6efc87b7061808'
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
'master'
)
}
expect
(
pipeline
.
all_merge_requests
).
to
eq
([
merge_request
])
end
it
"returns merge request if pipeline runs any commit of the `source_branch`"
do
it
"returns all merge requests having the same source branch"
do
merge_request
=
create
(
:merge_request
,
source_project:
project
,
source_branch:
pipeline
.
ref
)
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:diff_head_sha
)
{
'97de212e80737a608d939f648d959671fb0a0142b'
}
expect
(
pipeline
.
all_merge_requests
).
to
eq
([
merge_request
])
end
it
"doesn't return merge request
if pipeline runs on a different `source_branch`
"
do
it
"doesn't return merge request
s having a different source branch
"
do
create
(
:merge_request
,
source_project:
project
,
source_branch:
'feature'
,
target_branch:
'master'
)
expect
(
pipeline
.
all_merge_requests
).
to
be_empty
...
...
spec/workers/expire_pipeline_cache_worker_spec.rb
View file @
95662468
...
...
@@ -18,8 +18,7 @@ describe ExpirePipelineCacheWorker do
end
it
'invalidates Etag caching for merge request pipelines if pipeline runs on any commit of that source branch'
do
project
=
create
(
:project
,
:repository
)
pipeline
=
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
'master'
,
sha:
project
.
repository
.
commit
(
'master^'
).
id
)
pipeline
=
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
'master'
)
merge_request
=
create
(
:merge_request
,
source_project:
project
,
source_branch:
pipeline
.
ref
)
merge_request_pipelines_path
=
"/
#{
project
.
full_path
}
/merge_requests/
#{
merge_request
.
iid
}
/pipelines.json"
...
...
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