BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
41a2b9da
Commit
41a2b9da
authored
May 29, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sh-fix-issue-33011' into 'master'
Fix failing spec in spec/requests/api/pipelines_spec.rb Closes #33001 See merge request !11756
parents
c9e9c2ff
2a113034
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
pipelines_spec.rb
spec/requests/api/pipelines_spec.rb
+16
-10
No files found.
spec/requests/api/pipelines_spec.rb
View file @
41a2b9da
...
...
@@ -7,7 +7,7 @@ describe API::Pipelines do
let!
(
:pipeline
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
ref:
project
.
default_branch
,
user:
user
)
end
before
{
project
.
team
<<
[
user
,
:master
]
}
...
...
@@ -232,20 +232,26 @@ describe API::Pipelines do
context
'when order_by and sort are specified'
do
context
'when order_by user_id'
do
let!
(
:pipeline
)
{
create_list
(
:ci_pipeline
,
2
,
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
pipeline
.
sort_by
{
|
p
|
p
.
user
.
id
}.
tap
do
|
sorted_pipeline
|
json_response
.
each_with_index
{
|
r
,
i
|
expect
(
r
[
'id'
]).
to
eq
(
sorted_pipeline
[
i
].
id
)
}
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: :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