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
Tatuya Kamada
gitlab-ce
Commits
df97e21c
Commit
df97e21c
authored
Feb 14, 2017
by
George Andrinopoulos
Committed by
Rémy Coutable
Feb 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rebase to master for avoiding failing tests
parent
f106ad51
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
changelogs/unreleased/26875-builds-api-endpoint-skipped-scope.yml
...gs/unreleased/26875-builds-api-endpoint-skipped-scope.yml
+4
-0
lib/api/builds.rb
lib/api/builds.rb
+1
-1
spec/requests/api/builds_spec.rb
spec/requests/api/builds_spec.rb
+14
-0
No files found.
changelogs/unreleased/26875-builds-api-endpoint-skipped-scope.yml
0 → 100644
View file @
df97e21c
---
title
:
Add all available statuses to scope filter for project builds endpoint
merge_request
:
author
:
George Andrinopoulos
lib/api/builds.rb
View file @
df97e21c
...
@@ -11,7 +11,7 @@ module API
...
@@ -11,7 +11,7 @@ module API
helpers
do
helpers
do
params
:optional_scope
do
params
:optional_scope
do
optional
:scope
,
types:
[
String
,
Array
[
String
]],
desc:
'The scope of builds to show'
,
optional
:scope
,
types:
[
String
,
Array
[
String
]],
desc:
'The scope of builds to show'
,
values:
[
'pending'
,
'running'
,
'failed'
,
'success'
,
'canceled'
]
,
values:
::
CommitStatus
::
AVAILABLE_STATUSES
,
coerce_with:
->
(
scope
)
{
coerce_with:
->
(
scope
)
{
if
scope
.
is_a?
(
String
)
if
scope
.
is_a?
(
String
)
[
scope
]
[
scope
]
...
...
spec/requests/api/builds_spec.rb
View file @
df97e21c
...
@@ -16,6 +16,8 @@ describe API::Builds, api: true do
...
@@ -16,6 +16,8 @@ describe API::Builds, api: true do
let
(
:query
)
{
''
}
let
(
:query
)
{
''
}
before
do
before
do
create
(
:ci_build
,
:skipped
,
pipeline:
pipeline
)
get
api
(
"/projects/
#{
project
.
id
}
/builds?
#{
query
}
"
,
api_user
)
get
api
(
"/projects/
#{
project
.
id
}
/builds?
#{
query
}
"
,
api_user
)
end
end
...
@@ -49,6 +51,18 @@ describe API::Builds, api: true do
...
@@ -49,6 +51,18 @@ describe API::Builds, api: true do
end
end
end
end
context
'filter project with scope skipped'
do
let
(
:query
)
{
'scope=skipped'
}
let
(
:json_build
)
{
json_response
.
first
}
it
'return builds with status skipped'
do
expect
(
response
).
to
have_http_status
200
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
1
expect
(
json_build
[
'status'
]).
to
eq
'skipped'
end
end
context
'filter project with array of scope elements'
do
context
'filter project with array of scope elements'
do
let
(
:query
)
{
'scope[0]=pending&scope[1]=running'
}
let
(
:query
)
{
'scope[0]=pending&scope[1]=running'
}
...
...
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