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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a32ace0f
Commit
a32ace0f
authored
Mar 29, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use HTTP status matcher in todo API specs
parent
c2cb1834
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
spec/requests/api/todos_spec.rb
spec/requests/api/todos_spec.rb
+13
-13
No files found.
spec/requests/api/todos_spec.rb
View file @
a32ace0f
...
...
@@ -29,7 +29,7 @@ describe API::Todos do
it
'returns authentication error'
do
get
api
(
'/todos'
)
expect
(
response
.
status
).
to
eq
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
...
...
@@ -37,7 +37,7 @@ describe API::Todos do
it
'returns an array of pending todos for current user'
do
get
api
(
'/todos'
,
john_doe
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
4
)
...
...
@@ -74,7 +74,7 @@ describe API::Todos do
it
'filters based on author_id param'
do
get
api
(
'/todos'
,
john_doe
),
params:
{
author_id:
author_2
.
id
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
...
...
@@ -87,7 +87,7 @@ describe API::Todos do
get
api
(
'/todos'
,
john_doe
),
params:
{
type:
'MergeRequest'
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
...
...
@@ -98,7 +98,7 @@ describe API::Todos do
it
'filters based on state param'
do
get
api
(
'/todos'
,
john_doe
),
params:
{
state:
'done'
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
...
...
@@ -109,7 +109,7 @@ describe API::Todos do
it
'filters based on project_id param'
do
get
api
(
'/todos'
,
john_doe
),
params:
{
project_id:
project_2
.
id
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
...
...
@@ -120,7 +120,7 @@ describe API::Todos do
it
'filters based on project_id param'
do
get
api
(
'/todos'
,
john_doe
),
params:
{
group_id:
group
.
id
,
sort: :target_id
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
...
...
@@ -131,7 +131,7 @@ describe API::Todos do
it
'filters based on action param'
do
get
api
(
'/todos'
,
john_doe
),
params:
{
action:
'mentioned'
}
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
...
...
@@ -157,7 +157,7 @@ describe API::Todos do
create
(
:on_commit_todo
,
project:
project_3
,
author:
author_1
,
user:
john_doe
)
expect
{
get
api
(
'/todos'
,
john_doe
)
}.
not_to
exceed_query_limit
(
control
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
...
...
@@ -189,7 +189,7 @@ describe API::Todos do
it
'returns 404 if the todo does not belong to the current user'
do
post
api
(
"/todos/
#{
pending_1
.
id
}
/mark_as_done"
,
author_1
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
...
...
@@ -225,7 +225,7 @@ describe API::Todos do
it
'creates a todo on an issuable'
do
post
api
(
"/projects/
#{
project_1
.
id
}
/
#{
issuable_type
}
/
#{
issuable
.
iid
}
/todo"
,
john_doe
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
json_response
[
'project'
]).
to
be_a
Hash
expect
(
json_response
[
'author'
]).
to
be_a
Hash
expect
(
json_response
[
'target_type'
]).
to
eq
(
issuable
.
class
.
name
)
...
...
@@ -242,13 +242,13 @@ describe API::Todos do
post
api
(
"/projects/
#{
project_1
.
id
}
/
#{
issuable_type
}
/
#{
issuable
.
iid
}
/todo"
,
john_doe
)
expect
(
response
.
status
).
to
eq
(
304
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_modified
)
end
it
'returns 404 if the issuable is not found'
do
post
api
(
"/projects/
#{
project_1
.
id
}
/
#{
issuable_type
}
/123/todo"
,
john_doe
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
it
'returns an error if the issuable is not accessible'
do
...
...
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