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
2a113034
Commit
2a113034
authored
May 29, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve pipelines API specs related to special parameters
parent
393f24ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
spec/requests/api/pipelines_spec.rb
spec/requests/api/pipelines_spec.rb
+15
-9
No files found.
spec/requests/api/pipelines_spec.rb
View file @
2a113034
...
...
@@ -232,20 +232,26 @@ describe API::Pipelines do
context
'when order_by and sort are specified'
do
context
'when order_by user_id'
do
before
{
3
.
times
{
create
(
:ci_pipeline
,
project:
project
,
user:
create
(
:user
))
}
}
before
do
3
.
times
do
create
(
:ci_pipeline
,
project:
project
,
user:
create
(
:user
))
end
end
it
'sorts as user_id: :asc'
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines"
,
user
),
order_by:
'user_id'
,
sort:
'asc'
context
'when sort parameter is valid'
do
it
'sorts as user_id: :desc'
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines"
,
user
),
order_by:
'user_id'
,
sort:
'desc'
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
not_to
be_empty
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
not_to
be_empty
pipeline_ids
=
Ci
::
Pipeline
.
all
.
order
(
:user_id
).
map
(
&
:id
)
expect
(
json_response
.
map
{
|
r
|
r
[
'id'
]
}).
to
eq
(
pipeline_ids
)
pipeline_ids
=
Ci
::
Pipeline
.
all
.
order
(
user_id: :desc
).
pluck
(
:id
)
expect
(
json_response
.
map
{
|
r
|
r
[
'id'
]
}).
to
eq
(
pipeline_ids
)
end
end
context
'when sort is invalid'
do
context
'when sort
parameter
is invalid'
do
it
'returns bad_request'
do
get
api
(
"/projects/
#{
project
.
id
}
/pipelines"
,
user
),
order_by:
'user_id'
,
sort:
'invalid_sort'
...
...
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