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
Jérome Perrin
gitlab-ce
Commits
dc39c837
Commit
dc39c837
authored
Apr 12, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt tests to new testing guidelines
parent
49484f9a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
lib/api/notes.rb
lib/api/notes.rb
+2
-0
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+6
-6
spec/services/notes/delete_service_spec.rb
spec/services/notes/delete_service_spec.rb
+4
-5
No files found.
lib/api/notes.rb
View file @
dc39c837
...
...
@@ -124,7 +124,9 @@ module API
delete
":id/
#{
noteables_str
}
/:
#{
noteable_id_str
}
/notes/:note_id"
do
note
=
user_project
.
notes
.
find
(
params
[
:note_id
])
authorize!
:admin_note
,
note
::
Notes
::
DeleteService
.
new
(
user_project
,
current_user
).
execute
(
note
)
present
note
,
with:
Entities
::
Note
end
end
...
...
spec/requests/api/notes_spec.rb
View file @
dc39c837
...
...
@@ -243,7 +243,7 @@ describe API::API, api: true do
describe
'DELETE /projects/:id/noteable/:noteable_id/notes/:note_id'
do
context
'when noteable is an Issue'
do
it
'
should delete
a note'
do
it
'
deletes
a note'
do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/"
\
"notes/
#{
issue_note
.
id
}
"
,
user
)
...
...
@@ -254,7 +254,7 @@ describe API::API, api: true do
expect
(
response
.
status
).
to
eq
(
404
)
end
it
'
should return
a 404 error when note id not found'
do
it
'
returns
a 404 error when note id not found'
do
delete
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
/notes/123"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
...
...
@@ -262,7 +262,7 @@ describe API::API, api: true do
end
context
'when noteable is a Snippet'
do
it
'
should delete
a note'
do
it
'
deletes
a note'
do
delete
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/"
\
"notes/
#{
snippet_note
.
id
}
"
,
user
)
...
...
@@ -273,7 +273,7 @@ describe API::API, api: true do
expect
(
response
.
status
).
to
eq
(
404
)
end
it
'
should return
a 404 error when note id not found'
do
it
'
returns
a 404 error when note id not found'
do
delete
api
(
"/projects/
#{
project
.
id
}
/snippets/
#{
snippet
.
id
}
/"
\
"notes/123"
,
user
)
...
...
@@ -282,7 +282,7 @@ describe API::API, api: true do
end
context
'when noteable is a Merge Request'
do
it
'
should delete
a note'
do
it
'
deletes
a note'
do
delete
api
(
"/projects/
#{
project
.
id
}
/merge_requests/"
\
"
#{
merge_request
.
id
}
/notes/
#{
merge_request_note
.
id
}
"
,
user
)
...
...
@@ -293,7 +293,7 @@ describe API::API, api: true do
expect
(
response
.
status
).
to
eq
(
404
)
end
it
'
should return
a 404 error when note id not found'
do
it
'
returns
a 404 error when note id not found'
do
delete
api
(
"/projects/
#{
project
.
id
}
/merge_requests/"
\
"
#{
merge_request
.
id
}
/notes/123"
,
user
)
...
...
spec/services/notes/delete_service_spec.rb
View file @
dc39c837
require
'spec_helper'
describe
Notes
::
DeleteService
,
services:
true
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:note
)
{
create
(
:note
,
project:
project
,
noteable:
issue
)
}
describe
'#execute'
do
it
'deletes a note'
do
project
=
note
.
project
project
=
create
(
:empty_project
)
issue
=
create
(
:issue
,
project:
project
)
note
=
create
(
:note
,
project:
project
,
noteable:
issue
)
described_class
.
new
(
project
,
note
.
author
).
execute
(
note
)
expect
(
project
.
issues
.
find
(
issue
.
id
).
notes
).
not_to
include
(
note
)
...
...
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