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
Léo-Paul Géneau
gitlab-ce
Commits
2075d7ce
Commit
2075d7ce
authored
Mar 15, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unveil iteration
parent
2894f293
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
spec/requests/api/pipelines_spec.rb
spec/requests/api/pipelines_spec.rb
+29
-10
No files found.
spec/requests/api/pipelines_spec.rb
View file @
2075d7ce
...
@@ -43,24 +43,43 @@ describe API::Pipelines do
...
@@ -43,24 +43,43 @@ describe API::Pipelines do
end
end
context
'when scope is passed'
do
context
'when scope is passed'
do
%w[running pending
finished branches tags
]
.
each
do
|
target
|
%w[running pending]
.
each
do
|
target
|
it
"returns only scope=
#{
target
}
pipelines"
do
it
"returns only scope=
#{
target
}
pipelines"
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines?scope=
#{
target
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/pipelines?scope=
#{
target
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
count
).
to
be
>
0
expect
(
json_response
.
count
).
to
be
>
0
if
target
==
'running'
||
target
==
'pending'
json_response
.
each
{
|
r
|
expect
(
r
[
'status'
]).
to
eq
(
target
)
}
json_response
.
each
{
|
r
|
expect
(
r
[
'status'
]).
to
eq
(
target
)
}
elsif
target
==
'finished'
json_response
.
each
{
|
r
|
expect
(
r
[
'status'
]).
to
be_in
(
%w[success failed canceled]
)
}
elsif
target
==
'branches'
expect
(
json_response
.
last
[
'sha'
]).
to
eq
(
Ci
::
Pipeline
.
where
(
tag:
false
).
last
.
sha
)
elsif
target
==
'tags'
expect
(
json_response
.
last
[
'sha'
]).
to
eq
(
Ci
::
Pipeline
.
where
(
tag:
true
).
last
.
sha
)
end
end
end
end
end
it
"returns only scope=finished pipelines"
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines?scope=finished"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
count
).
to
be
>
0
json_response
.
each
{
|
r
|
expect
(
r
[
'status'
]).
to
be_in
(
%w[success failed canceled]
)
}
end
it
"returns only scope=branches pipelines"
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines?scope=branches"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
count
).
to
be
>
0
expect
(
json_response
.
last
[
'sha'
]).
to
eq
(
Ci
::
Pipeline
.
where
(
tag:
false
).
last
.
sha
)
end
it
"returns only scope=tags pipelines"
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines?scope=tags"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
count
).
to
be
>
0
expect
(
json_response
.
last
[
'sha'
]).
to
eq
(
Ci
::
Pipeline
.
where
(
tag:
true
).
last
.
sha
)
end
end
end
context
'when status is passed'
do
context
'when status is passed'
do
...
...
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