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
93ca5c99
Commit
93ca5c99
authored
May 10, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix notes API calls symbol convertions
parent
e56e3cdc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
lib/api/notes.rb
lib/api/notes.rb
+3
-3
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+31
-0
No files found.
lib/api/notes.rb
View file @
93ca5c99
...
@@ -19,7 +19,7 @@ module API
...
@@ -19,7 +19,7 @@ module API
# GET /projects/:id/issues/:noteable_id/notes
# GET /projects/:id/issues/:noteable_id/notes
# GET /projects/:id/snippets/:noteable_id/notes
# GET /projects/:id/snippets/:noteable_id/notes
get
":id/
#{
noteables_str
}
/:
#{
noteable_id_str
}
/notes"
do
get
":id/
#{
noteables_str
}
/:
#{
noteable_id_str
}
/notes"
do
@noteable
=
user_project
.
send
(
:"
#{
noteables_str
}
"
).
find
(
params
[
:"
#{
noteable_id_str
}
"
])
@noteable
=
user_project
.
send
(
noteables_str
.
to_sym
).
find
(
params
[
noteable_id_str
.
to_sym
])
read_ability_name
=
"read_
#{
@noteable
.
class
.
to_s
.
underscore
.
downcase
}
"
.
to_sym
read_ability_name
=
"read_
#{
@noteable
.
class
.
to_s
.
underscore
.
downcase
}
"
.
to_sym
if
can?
(
current_user
,
read_ability_name
,
@noteable
)
if
can?
(
current_user
,
read_ability_name
,
@noteable
)
...
@@ -36,7 +36,7 @@ module API
...
@@ -36,7 +36,7 @@ module API
reject
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
reject
{
|
n
|
n
.
cross_reference_not_visible_for?
(
current_user
)
}
present
notes
,
with:
Entities
::
Note
present
notes
,
with:
Entities
::
Note
else
else
render_api_error!
(
"Not found."
,
404
)
not_found!
(
"Notes"
)
end
end
end
end
...
@@ -50,7 +50,7 @@ module API
...
@@ -50,7 +50,7 @@ module API
# GET /projects/:id/issues/:noteable_id/notes/:note_id
# GET /projects/:id/issues/:noteable_id/notes/:note_id
# GET /projects/:id/snippets/:noteable_id/notes/:note_id
# GET /projects/:id/snippets/:noteable_id/notes/:note_id
get
":id/
#{
noteables_str
}
/:
#{
noteable_id_str
}
/notes/:note_id"
do
get
":id/
#{
noteables_str
}
/:
#{
noteable_id_str
}
/notes/:note_id"
do
@noteable
=
user_project
.
send
(
:"
#{
noteables_str
}
"
).
find
(
params
[
:"
#{
noteable_id_str
}
"
])
@noteable
=
user_project
.
send
(
noteables_str
.
to_sym
).
find
(
params
[
noteable_id_str
.
to_sym
])
@note
=
@noteable
.
notes
.
find
(
params
[
:note_id
])
@note
=
@noteable
.
notes
.
find
(
params
[
:note_id
])
if
@note
.
cross_reference_not_visible_for?
(
current_user
)
if
@note
.
cross_reference_not_visible_for?
(
current_user
)
...
...
spec/requests/api/notes_spec.rb
View file @
93ca5c99
...
@@ -39,6 +39,7 @@ describe API::API, api: true do
...
@@ -39,6 +39,7 @@ describe API::API, api: true do
context
"when noteable is an Issue"
do
context
"when noteable is an Issue"
do
it
"should return an array of issue notes"
do
it
"should return an array of issue notes"
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'body'
]).
to
eq
(
issue_note
.
note
)
expect
(
json_response
.
first
[
'body'
]).
to
eq
(
issue_note
.
note
)
...
@@ -46,12 +47,14 @@ describe API::API, api: true do
...
@@ -46,12 +47,14 @@ describe API::API, api: true do
it
"should return a 404 error when issue id not found"
do
it
"should return a 404 error when issue id not found"
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/12345/notes"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/12345/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
context
"that references a private issue"
do
context
"that references a private issue"
do
it
"should return an empty array"
do
it
"should return an empty array"
do
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes"
,
user
)
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_empty
expect
(
json_response
).
to
be_empty
...
@@ -62,6 +65,7 @@ describe API::API, api: true do
...
@@ -62,6 +65,7 @@ describe API::API, api: true do
it
"returns 404"
do
it
"returns 404"
do
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes"
,
user
)
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
...
@@ -69,6 +73,7 @@ describe API::API, api: true do
...
@@ -69,6 +73,7 @@ describe API::API, api: true do
context
"and current user can view the note"
do
context
"and current user can view the note"
do
it
"should return an empty array"
do
it
"should return an empty array"
do
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes"
,
private_user
)
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes"
,
private_user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'body'
]).
to
eq
(
cross_reference_note
.
note
)
expect
(
json_response
.
first
[
'body'
]).
to
eq
(
cross_reference_note
.
note
)
...
@@ -80,6 +85,7 @@ describe API::API, api: true do
...
@@ -80,6 +85,7 @@ describe API::API, api: true do
context
"when noteable is a Snippet"
do
context
"when noteable is a Snippet"
do
it
"should return an array of snippet notes"
do
it
"should return an array of snippet notes"
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'body'
]).
to
eq
(
snippet_note
.
note
)
expect
(
json_response
.
first
[
'body'
]).
to
eq
(
snippet_note
.
note
)
...
@@ -87,11 +93,13 @@ describe API::API, api: true do
...
@@ -87,11 +93,13 @@ describe API::API, api: true do
it
"should return a 404 error when snippet id not found"
do
it
"should return a 404 error when snippet id not found"
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/42/notes"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/snippets/42/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
it
"returns 404 when not authorized"
do
it
"returns 404 when not authorized"
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
,
private_user
)
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
,
private_user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
...
@@ -99,6 +107,7 @@ describe API::API, api: true do
...
@@ -99,6 +107,7 @@ describe API::API, api: true do
context
"when noteable is a Merge Request"
do
context
"when noteable is a Merge Request"
do
it
"should return an array of merge_requests notes"
do
it
"should return an array of merge_requests notes"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/notes"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'body'
]).
to
eq
(
merge_request_note
.
note
)
expect
(
json_response
.
first
[
'body'
]).
to
eq
(
merge_request_note
.
note
)
...
@@ -106,11 +115,13 @@ describe API::API, api: true do
...
@@ -106,11 +115,13 @@ describe API::API, api: true do
it
"should return a 404 error if merge request id not found"
do
it
"should return a 404 error if merge request id not found"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/4444/notes"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/4444/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
it
"returns 404 when not authorized"
do
it
"returns 404 when not authorized"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/4444/notes"
,
private_user
)
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/4444/notes"
,
private_user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
...
@@ -120,24 +131,28 @@ describe API::API, api: true do
...
@@ -120,24 +131,28 @@ describe API::API, api: true do
context
"when noteable is an Issue"
do
context
"when noteable is an Issue"
do
it
"should return an issue note by id"
do
it
"should return an issue note by id"
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes/
#{
issue_note
.
id
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes/
#{
issue_note
.
id
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'body'
]).
to
eq
(
issue_note
.
note
)
expect
(
json_response
[
'body'
]).
to
eq
(
issue_note
.
note
)
end
end
it
"should return a 404 error if issue note not found"
do
it
"should return a 404 error if issue note not found"
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes/12345"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes/12345"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
context
"that references a private issue"
do
context
"that references a private issue"
do
it
"should return a 404 error"
do
it
"should return a 404 error"
do
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes/
#{
cross_reference_note
.
id
}
"
,
user
)
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes/
#{
cross_reference_note
.
id
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
context
"and current user can view the note"
do
context
"and current user can view the note"
do
it
"should return an issue note by id"
do
it
"should return an issue note by id"
do
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes/
#{
cross_reference_note
.
id
}
"
,
private_user
)
get
api
(
"/projects/
#{
ext_proj
.
id
}
/issues/
#{
ext_issue
.
id
}
/notes/
#{
cross_reference_note
.
id
}
"
,
private_user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'body'
]).
to
eq
(
cross_reference_note
.
note
)
expect
(
json_response
[
'body'
]).
to
eq
(
cross_reference_note
.
note
)
end
end
...
@@ -148,12 +163,14 @@ describe API::API, api: true do
...
@@ -148,12 +163,14 @@ describe API::API, api: true do
context
"when noteable is a Snippet"
do
context
"when noteable is a Snippet"
do
it
"should return a snippet note by id"
do
it
"should return a snippet note by id"
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes/
#{
snippet_note
.
id
}
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes/
#{
snippet_note
.
id
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'body'
]).
to
eq
(
snippet_note
.
note
)
expect
(
json_response
[
'body'
]).
to
eq
(
snippet_note
.
note
)
end
end
it
"should return a 404 error if snippet note not found"
do
it
"should return a 404 error if snippet note not found"
do
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes/12345"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes/12345"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
...
@@ -163,6 +180,7 @@ describe API::API, api: true do
...
@@ -163,6 +180,7 @@ describe API::API, api: true do
context
"when noteable is an Issue"
do
context
"when noteable is an Issue"
do
it
"should create a new issue note"
do
it
"should create a new issue note"
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
),
body:
'hi!'
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
),
body:
'hi!'
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
...
@@ -170,11 +188,13 @@ describe API::API, api: true do
...
@@ -170,11 +188,13 @@ describe API::API, api: true do
it
"should return a 400 bad request error if body not given"
do
it
"should return a 400 bad request error if body not given"
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
400
)
expect
(
response
.
status
).
to
eq
(
400
)
end
end
it
"should return a 401 unauthorized error if user not authenticated"
do
it
"should return a 401 unauthorized error if user not authenticated"
do
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
),
body:
'hi!'
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
),
body:
'hi!'
expect
(
response
.
status
).
to
eq
(
401
)
expect
(
response
.
status
).
to
eq
(
401
)
end
end
...
@@ -183,6 +203,7 @@ describe API::API, api: true do
...
@@ -183,6 +203,7 @@ describe API::API, api: true do
creation_time
=
2
.
weeks
.
ago
creation_time
=
2
.
weeks
.
ago
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes"
,
user
),
body:
'hi!'
,
created_at:
creation_time
body:
'hi!'
,
created_at:
creation_time
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
...
@@ -195,6 +216,7 @@ describe API::API, api: true do
...
@@ -195,6 +216,7 @@ describe API::API, api: true do
context
"when noteable is a Snippet"
do
context
"when noteable is a Snippet"
do
it
"should create a new snippet note"
do
it
"should create a new snippet note"
do
post
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
,
user
),
body:
'hi!'
post
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
,
user
),
body:
'hi!'
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
expect
(
json_response
[
'author'
][
'username'
]).
to
eq
(
user
.
username
)
...
@@ -202,11 +224,13 @@ describe API::API, api: true do
...
@@ -202,11 +224,13 @@ describe API::API, api: true do
it
"should return a 400 bad request error if body not given"
do
it
"should return a 400 bad request error if body not given"
do
post
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
,
user
)
expect
(
response
.
status
).
to
eq
(
400
)
expect
(
response
.
status
).
to
eq
(
400
)
end
end
it
"should return a 401 unauthorized error if user not authenticated"
do
it
"should return a 401 unauthorized error if user not authenticated"
do
post
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
),
body:
'hi!'
post
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/notes"
),
body:
'hi!'
expect
(
response
.
status
).
to
eq
(
401
)
expect
(
response
.
status
).
to
eq
(
401
)
end
end
end
end
...
@@ -246,6 +270,7 @@ describe API::API, api: true do
...
@@ -246,6 +270,7 @@ describe API::API, api: true do
it
'should return modified note'
do
it
'should return modified note'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/"
\
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/"
\
"notes/
#{
issue_note
.
id
}
"
,
user
),
body:
'Hello!'
"notes/
#{
issue_note
.
id
}
"
,
user
),
body:
'Hello!'
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'body'
]).
to
eq
(
'Hello!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'Hello!'
)
end
end
...
@@ -253,12 +278,14 @@ describe API::API, api: true do
...
@@ -253,12 +278,14 @@ describe API::API, api: true do
it
'should return a 404 error when note id not found'
do
it
'should return a 404 error when note id not found'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes/12345"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes/12345"
,
user
),
body:
'Hello!'
body:
'Hello!'
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
it
'should return a 400 bad request error if body not given'
do
it
'should return a 400 bad request error if body not given'
do
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/"
\
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/"
\
"notes/
#{
issue_note
.
id
}
"
,
user
)
"notes/
#{
issue_note
.
id
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
400
)
expect
(
response
.
status
).
to
eq
(
400
)
end
end
end
end
...
@@ -267,6 +294,7 @@ describe API::API, api: true do
...
@@ -267,6 +294,7 @@ describe API::API, api: true do
it
'should return modified note'
do
it
'should return modified note'
do
put
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/"
\
put
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/"
\
"notes/
#{
snippet_note
.
id
}
"
,
user
),
body:
'Hello!'
"notes/
#{
snippet_note
.
id
}
"
,
user
),
body:
'Hello!'
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'body'
]).
to
eq
(
'Hello!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'Hello!'
)
end
end
...
@@ -274,6 +302,7 @@ describe API::API, api: true do
...
@@ -274,6 +302,7 @@ describe API::API, api: true do
it
'should return a 404 error when note id not found'
do
it
'should return a 404 error when note id not found'
do
put
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/"
\
put
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/"
\
"notes/12345"
,
user
),
body:
"Hello!"
"notes/12345"
,
user
),
body:
"Hello!"
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
...
@@ -282,6 +311,7 @@ describe API::API, api: true do
...
@@ -282,6 +311,7 @@ describe API::API, api: true do
it
'should return modified note'
do
it
'should return modified note'
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/"
\
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/"
\
"notes/
#{
merge_request_note
.
id
}
"
,
user
),
body:
'Hello!'
"notes/
#{
merge_request_note
.
id
}
"
,
user
),
body:
'Hello!'
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'body'
]).
to
eq
(
'Hello!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'Hello!'
)
end
end
...
@@ -289,6 +319,7 @@ describe API::API, api: true do
...
@@ -289,6 +319,7 @@ describe API::API, api: true do
it
'should return a 404 error when note id not found'
do
it
'should return a 404 error when note id not found'
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/"
\
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/"
\
"notes/12345"
,
user
),
body:
"Hello!"
"notes/12345"
,
user
),
body:
"Hello!"
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
...
...
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