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
44b2d759
Commit
44b2d759
authored
Feb 16, 2019
by
Nermin Vehabovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added: Specs to cover other endpoints for the same reason
parent
c8352c9f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
6 deletions
+62
-6
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+62
-6
No files found.
spec/requests/api/issues_spec.rb
View file @
44b2d759
...
...
@@ -641,12 +641,40 @@ describe API::Issues do
expect_paginated_array_response
(
group_confidential_issue
.
id
)
end
context
'without sort params'
do
it
'sorts by created_at descending by default'
do
get
api
(
base_url
,
user
)
expect_paginated_array_response
([
group_closed_issue
.
id
,
group_confidential_issue
.
id
,
group_issue
.
id
])
end
context
'with 2 issues with same created_at'
do
let!
(
:group_issue2
)
do
create
:issue
,
author:
user
,
assignees:
[
user
],
project:
group_project
,
milestone:
group_milestone
,
updated_at:
1
.
hour
.
ago
,
title:
issue_title
,
description:
issue_description
,
created_at:
group_issue
.
created_at
end
it
'page breaks first page correctly'
do
get
api
(
"
#{
base_url
}
?per_page=3"
,
user
)
expect_paginated_array_response
([
group_closed_issue
.
id
,
group_confidential_issue
.
id
,
group_issue2
.
id
])
end
it
'page breaks second page correctly'
do
get
api
(
"
#{
base_url
}
?per_page=3&page=2"
,
user
)
expect_paginated_array_response
([
group_issue
.
id
])
end
end
end
it
'sorts ascending when requested'
do
get
api
(
"
#{
base_url
}
?sort=asc"
,
user
)
...
...
@@ -856,12 +884,40 @@ describe API::Issues do
expect_paginated_array_response
([
issue
.
id
,
closed_issue
.
id
])
end
context
'without sort params'
do
it
'sorts by created_at descending by default'
do
get
api
(
"
#{
base_url
}
/issues"
,
user
)
expect_paginated_array_response
([
issue
.
id
,
confidential_issue
.
id
,
closed_issue
.
id
])
end
context
'with 2 issues with same created_at'
do
let!
(
:closed_issue2
)
do
create
:closed_issue
,
author:
user
,
assignees:
[
user
],
project:
project
,
milestone:
milestone
,
created_at:
closed_issue
.
created_at
,
updated_at:
1
.
hour
.
ago
,
title:
issue_title
,
description:
issue_description
end
it
'page breaks first page correctly'
do
get
api
(
"
#{
base_url
}
/issues?per_page=3"
,
user
)
expect_paginated_array_response
([
issue
.
id
,
confidential_issue
.
id
,
closed_issue2
.
id
])
end
it
'page breaks second page correctly'
do
get
api
(
"
#{
base_url
}
/issues?per_page=3&page=2"
,
user
)
expect_paginated_array_response
([
closed_issue
.
id
])
end
end
end
it
'sorts ascending when requested'
do
get
api
(
"
#{
base_url
}
/issues"
,
user
),
params:
{
sort: :asc
}
...
...
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