Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GitLab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
projects.thm.de
GitLab
Commits
c70dfbc6
Commit
c70dfbc6
authored
Jan 24, 2017
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a custom pagination matcher
parent
01ea65e0
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
274 additions
and
36 deletions
+274
-36
spec/requests/api/access_requests_spec.rb
spec/requests/api/access_requests_spec.rb
+1
-0
spec/requests/api/award_emoji_spec.rb
spec/requests/api/award_emoji_spec.rb
+1
-0
spec/requests/api/boards_spec.rb
spec/requests/api/boards_spec.rb
+2
-0
spec/requests/api/branches_spec.rb
spec/requests/api/branches_spec.rb
+2
-0
spec/requests/api/broadcast_messages_spec.rb
spec/requests/api/broadcast_messages_spec.rb
+1
-0
spec/requests/api/builds_spec.rb
spec/requests/api/builds_spec.rb
+2
-0
spec/requests/api/commit_statuses_spec.rb
spec/requests/api/commit_statuses_spec.rb
+3
-3
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+1
-0
spec/requests/api/deploy_keys_spec.rb
spec/requests/api/deploy_keys_spec.rb
+2
-0
spec/requests/api/deployments_spec.rb
spec/requests/api/deployments_spec.rb
+1
-0
spec/requests/api/environments_spec.rb
spec/requests/api/environments_spec.rb
+1
-0
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+17
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+88
-14
spec/requests/api/labels_spec.rb
spec/requests/api/labels_spec.rb
+1
-0
spec/requests/api/members_spec.rb
spec/requests/api/members_spec.rb
+7
-0
spec/requests/api/merge_request_diffs_spec.rb
spec/requests/api/merge_request_diffs_spec.rb
+2
-0
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+26
-0
spec/requests/api/milestones_spec.rb
spec/requests/api/milestones_spec.rb
+19
-0
spec/requests/api/namespaces_spec.rb
spec/requests/api/namespaces_spec.rb
+8
-4
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+5
-0
spec/requests/api/project_hooks_spec.rb
spec/requests/api/project_hooks_spec.rb
+1
-0
spec/requests/api/project_snippets_spec.rb
spec/requests/api/project_snippets_spec.rb
+6
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+19
-2
spec/requests/api/repositories_spec.rb
spec/requests/api/repositories_spec.rb
+4
-3
spec/requests/api/runners_spec.rb
spec/requests/api/runners_spec.rb
+10
-5
spec/requests/api/snippets_spec.rb
spec/requests/api/snippets_spec.rb
+7
-0
spec/requests/api/system_hooks_spec.rb
spec/requests/api/system_hooks_spec.rb
+1
-0
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+6
-4
spec/requests/api/templates_spec.rb
spec/requests/api/templates_spec.rb
+4
-0
spec/requests/api/todos_spec.rb
spec/requests/api/todos_spec.rb
+6
-0
spec/requests/api/triggers_spec.rb
spec/requests/api/triggers_spec.rb
+1
-0
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+14
-0
spec/support/matchers/pagination_matcher.rb
spec/support/matchers/pagination_matcher.rb
+5
-0
No files found.
spec/requests/api/access_requests_spec.rb
View file @
c70dfbc6
...
...
@@ -48,6 +48,7 @@
get
api
(
"/
#{
source_type
.
pluralize
}
/
#{
source
.
id
}
/access_requests"
,
master
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
(
1
)
end
...
...
spec/requests/api/award_emoji_spec.rb
View file @
c70dfbc6
...
...
@@ -34,6 +34,7 @@
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/award_emoji"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
downvote
.
name
)
end
...
...
spec/requests/api/boards_spec.rb
View file @
c70dfbc6
...
...
@@ -55,6 +55,7 @@
get
api
(
base_url
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
board
.
id
)
...
...
@@ -72,6 +73,7 @@
get
api
(
base_url
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'label'
][
'name'
]).
to
eq
(
dev_label
.
title
)
...
...
spec/requests/api/branches_spec.rb
View file @
c70dfbc6
...
...
@@ -18,7 +18,9 @@
project
.
repository
.
expire_all_method_caches
get
api
(
"/projects/
#{
project
.
id
}
/repository/branches"
,
user
),
per_page:
100
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
branch_names
=
json_response
.
map
{
|
x
|
x
[
'name'
]
}
expect
(
branch_names
).
to
match_array
(
project
.
repository
.
branch_names
)
...
...
spec/requests/api/broadcast_messages_spec.rb
View file @
c70dfbc6
...
...
@@ -25,6 +25,7 @@
get
api
(
'/broadcast_messages'
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_kind_of
(
Array
)
expect
(
json_response
.
first
.
keys
)
.
to
match_array
(
%w(id message starts_at ends_at color font active)
)
...
...
spec/requests/api/builds_spec.rb
View file @
c70dfbc6
...
...
@@ -22,6 +22,7 @@
context
'authorized user'
do
it
'returns project builds'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
end
...
...
@@ -97,6 +98,7 @@
it
'returns project jobs for specific commit'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
2
end
...
...
spec/requests/api/commit_statuses_spec.rb
View file @
c70dfbc6
...
...
@@ -54,7 +54,7 @@ def create_status(commit, opts = {})
it
'returns all commit statuses'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
statuses_id
).
to
contain_exactly
(
status1
.
id
,
status2
.
id
,
status3
.
id
,
status4
.
id
,
...
...
@@ -67,7 +67,7 @@ def create_status(commit, opts = {})
it
'returns latest commit statuses for specific ref'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
statuses_id
).
to
contain_exactly
(
status3
.
id
,
status5
.
id
)
end
...
...
@@ -78,7 +78,7 @@ def create_status(commit, opts = {})
it
'return latest commit statuses for specific name'
do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
statuses_id
).
to
contain_exactly
(
status4
.
id
,
status5
.
id
)
end
...
...
spec/requests/api/commits_spec.rb
View file @
c70dfbc6
...
...
@@ -456,6 +456,7 @@
it
'returns merge_request comments'
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
repository
.
commit
.
id
}
/comments"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'note'
]).
to
eq
(
'a comment on a commit'
)
...
...
spec/requests/api/deploy_keys_spec.rb
View file @
c70dfbc6
...
...
@@ -35,6 +35,7 @@
get
api
(
'/deploy_keys'
,
admin
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
deploy_keys_project
.
deploy_key
.
id
)
end
...
...
@@ -48,6 +49,7 @@
get
api
(
"/projects/
#{
project
.
id
}
/deploy_keys"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
deploy_key
.
title
)
end
...
...
spec/requests/api/deployments_spec.rb
View file @
c70dfbc6
...
...
@@ -22,6 +22,7 @@
get
api
(
"/projects/
#{
project
.
id
}
/deployments"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'iid'
]).
to
eq
(
deployment
.
iid
)
...
...
spec/requests/api/environments_spec.rb
View file @
c70dfbc6
...
...
@@ -22,6 +22,7 @@
get
api
(
"/projects/
#{
project
.
id
}
/environments"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
environment
.
name
)
...
...
spec/requests/api/groups_spec.rb
View file @
c70dfbc6
...
...
@@ -33,6 +33,7 @@
get
api
(
"/groups"
,
user1
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
)
...
...
@@ -43,6 +44,7 @@
get
api
(
"/groups"
,
user1
),
statistics:
true
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
).
not_to
include
'statistics'
end
...
...
@@ -53,6 +55,7 @@
get
api
(
"/groups"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
end
...
...
@@ -61,6 +64,7 @@
get
api
(
"/groups"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
).
not_to
include
(
'statistics'
)
end
...
...
@@ -78,6 +82,7 @@
get
api
(
"/groups"
,
admin
),
statistics:
true
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
)
.
to
satisfy_one
{
|
group
|
group
[
'statistics'
]
==
attributes
}
...
...
@@ -89,6 +94,7 @@
get
api
(
"/groups"
,
admin
),
skip_groups:
[
group2
.
id
]
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
end
...
...
@@ -103,6 +109,7 @@
get
api
(
"/groups"
,
user1
),
all_available:
true
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_groups
).
to
contain_exactly
(
public_group
.
name
,
group1
.
name
)
end
...
...
@@ -120,6 +127,7 @@
get
api
(
"/groups"
,
user1
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_groups
).
to
eq
([
group3
.
name
,
group1
.
name
])
end
...
...
@@ -128,6 +136,7 @@
get
api
(
"/groups"
,
user1
),
sort:
"desc"
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_groups
).
to
eq
([
group1
.
name
,
group3
.
name
])
end
...
...
@@ -136,6 +145,7 @@
get
api
(
"/groups"
,
user1
),
order_by:
"path"
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_groups
).
to
eq
([
group1
.
name
,
group3
.
name
])
end
...
...
@@ -156,6 +166,7 @@
get
api
(
'/groups/owned'
,
user2
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
group2
.
name
)
end
...
...
@@ -290,6 +301,7 @@
get
api
(
"/groups/
#{
group1
.
id
}
/projects"
,
user1
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
length
).
to
eq
(
2
)
project_names
=
json_response
.
map
{
|
proj
|
proj
[
'name'
]
}
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
])
...
...
@@ -300,6 +312,7 @@
get
api
(
"/groups/
#{
group1
.
id
}
/projects"
,
user1
),
simple:
true
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
length
).
to
eq
(
2
)
project_names
=
json_response
.
map
{
|
proj
|
proj
[
'name'
]
}
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
])
...
...
@@ -312,6 +325,7 @@
get
api
(
"/groups/
#{
group1
.
id
}
/projects"
,
user1
),
visibility:
'public'
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
public_project
.
name
)
...
...
@@ -335,6 +349,7 @@
get
api
(
"/groups/
#{
group1
.
id
}
/projects"
,
user3
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
project3
.
name
)
end
...
...
@@ -365,6 +380,7 @@
get
api
(
"/groups/
#{
group2
.
id
}
/projects"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
project2
.
name
)
end
...
...
@@ -381,6 +397,7 @@
get
api
(
"/groups/
#{
group1
.
path
}
/projects"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
project_names
=
json_response
.
map
{
|
proj
|
proj
[
'name'
]
}
expect
(
project_names
).
to
match_array
([
project1
.
name
,
project3
.
name
])
end
...
...
spec/requests/api/issues_spec.rb
View file @
c70dfbc6
...
...
@@ -68,7 +68,9 @@
context
"when authenticated"
do
it
"returns an array of issues"
do
get
api
(
"/issues"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
issue
.
title
)
expect
(
json_response
.
last
).
to
have_key
(
'web_url'
)
...
...
@@ -76,7 +78,9 @@
it
'returns an array of closed issues'
do
get
api
(
'/issues?state=closed'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
closed_issue
.
id
)
...
...
@@ -84,7 +88,9 @@
it
'returns an array of opened issues'
do
get
api
(
'/issues?state=opened'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
issue
.
id
)
...
...
@@ -92,7 +98,9 @@
it
'returns an array of all issues'
do
get
api
(
'/issues?state=all'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
issue
.
id
)
...
...
@@ -101,7 +109,9 @@
it
'returns an array of labeled issues'
do
get
api
(
"/issues?labels=
#{
label
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'labels'
]).
to
eq
([
label
.
title
])
...
...
@@ -111,6 +121,7 @@
get
api
(
"/issues?labels=
#{
label
.
title
}
,foo,bar"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'labels'
]).
to
eq
([
label
.
title
])
...
...
@@ -118,14 +129,18 @@
it
'returns an empty array if no issue matches labels'
do
get
api
(
'/issues?labels=foo,bar'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
it
'returns an array of labeled issues matching given state'
do
get
api
(
"/issues?labels=
#{
label
.
title
}
&state=opened"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'labels'
]).
to
eq
([
label
.
title
])
...
...
@@ -134,7 +149,9 @@
it
'returns an empty array if no issue matches labels and state filters'
do
get
api
(
"/issues?labels=
#{
label
.
title
}
&state=closed"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -143,6 +160,7 @@
get
api
(
"/issues?milestone=
#{
empty_milestone
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -151,6 +169,7 @@
get
api
(
"/issues?milestone=foo"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -159,6 +178,7 @@
get
api
(
"/issues?milestone=
#{
milestone
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
issue
.
id
)
...
...
@@ -170,6 +190,7 @@
'&state=closed'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
closed_issue
.
id
)
...
...
@@ -179,6 +200,7 @@
get
api
(
"/issues?milestone=
#{
no_milestone_title
}
"
,
author
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
confidential_issue
.
id
)
...
...
@@ -186,36 +208,40 @@
it
'sorts by created_at descending by default'
do
get
api
(
'/issues'
,
user
)
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'created_at'
]
}
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'created_at'
]
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_dates
).
to
eq
(
response_dates
.
sort
.
reverse
)
end
it
'sorts ascending when requested'
do
get
api
(
'/issues?sort=asc'
,
user
)
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'created_at'
]
}
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'created_at'
]
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_dates
).
to
eq
(
response_dates
.
sort
)
end
it
'sorts by updated_at descending when requested'
do
get
api
(
'/issues?order_by=updated_at'
,
user
)
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'updated_at'
]
}
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'updated_at'
]
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_dates
).
to
eq
(
response_dates
.
sort
.
reverse
)
end
it
'sorts by updated_at ascending when requested'
do
get
api
(
'/issues?order_by=updated_at&sort=asc'
,
user
)
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'updated_at'
]
}
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'updated_at'
]
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_dates
).
to
eq
(
response_dates
.
sort
)
end
...
...
@@ -269,6 +295,7 @@
get
api
(
base_url
,
non_member
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
group_issue
.
title
)
...
...
@@ -278,6 +305,7 @@
get
api
(
base_url
,
author
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
end
...
...
@@ -286,6 +314,7 @@
get
api
(
base_url
,
assignee
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
end
...
...
@@ -294,6 +323,7 @@
get
api
(
base_url
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
end
...
...
@@ -302,6 +332,7 @@
get
api
(
base_url
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
end
...
...
@@ -310,6 +341,7 @@
get
api
(
"
#{
base_url
}
?labels=
#{
group_label
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'labels'
]).
to
eq
([
group_label
.
title
])
...
...
@@ -319,6 +351,7 @@
get
api
(
"
#{
base_url
}
?labels=
#{
group_label
.
title
}
,foo,bar"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -327,6 +360,7 @@
get
api
(
"
#{
base_url
}
?labels=foo,bar"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -335,6 +369,7 @@
get
api
(
"
#{
base_url
}
?milestone=
#{
group_empty_milestone
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -343,6 +378,7 @@
get
api
(
"
#{
base_url
}
?milestone=foo"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -351,6 +387,7 @@
get
api
(
"
#{
base_url
}
?milestone=
#{
group_milestone
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
group_issue
.
id
)
...
...
@@ -361,6 +398,7 @@
'&state=closed'
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
group_closed_issue
.
id
)
...
...
@@ -370,6 +408,7 @@
get
api
(
"
#{
base_url
}
?milestone=
#{
no_milestone_title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
group_confidential_issue
.
id
)
...
...
@@ -377,36 +416,40 @@
it
'sorts by created_at descending by default'
do
get
api
(
base_url
,
user
)
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'created_at'
]
}
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'created_at'
]
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_dates
).
to
eq
(
response_dates
.
sort
.
reverse
)
end
it
'sorts ascending when requested'
do
get
api
(
"
#{
base_url
}
?sort=asc"
,
user
)
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'created_at'
]
}
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'created_at'
]
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_dates
).
to
eq
(
response_dates
.
sort
)
end
it
'sorts by updated_at descending when requested'
do
get
api
(
"
#{
base_url
}
?order_by=updated_at"
,
user
)
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'updated_at'
]
}
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'updated_at'
]
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_dates
).
to
eq
(
response_dates
.
sort
.
reverse
)
end
it
'sorts by updated_at ascending when requested'
do
get
api
(
"
#{
base_url
}
?order_by=updated_at&sort=asc"
,
user
)
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'updated_at'
]
}
response_dates
=
json_response
.
map
{
|
issue
|
issue
[
'updated_at'
]
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
response_dates
).
to
eq
(
response_dates
.
sort
)
end
...
...
@@ -430,12 +473,17 @@
get
api
(
"/projects/
#{
restricted_project
.
id
}
/issues"
,
non_member
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
eq
([])
end
it
'returns project issues without confidential issues for non project members'
do
get
api
(
"
#{
base_url
}
/issues"
,
non_member
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
issue
.
title
)
...
...
@@ -443,7 +491,9 @@
it
'returns project issues without confidential issues for project members with guest role'
do
get
api
(
"
#{
base_url
}
/issues"
,
guest
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
issue
.
title
)
...
...
@@ -451,7 +501,9 @@
it
'returns project confidential issues for author'
do
get
api
(
"
#{
base_url
}
/issues"
,
author
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
issue
.
title
)
...
...
@@ -459,7 +511,9 @@
it
'returns project confidential issues for assignee'
do
get
api
(
"
#{
base_url
}
/issues"
,
assignee
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
(
issue
.
title
)
...
...
@@ -46