diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2016-04-06 02:21:02 +0300 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2016-04-12 15:24:05 +0300 |
commit | ba21c00f01bf4274d0e4cc3892293fc1e581b260 (patch) | |
tree | 1d9133b41f4e30b8775002c72ef78ec28d213ace /spec/requests/api | |
parent | 734df1bb504aedec6a5668567de808b549a84749 (diff) |
Delete notes via API
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/notes_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 39f9a06fe1b..23d3c63bc1c 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -241,4 +241,47 @@ describe API::API, api: true do end end + describe ':id/#{noteables_str}/:#{noteable_id_str}/notes/:note_id' do + context 'when noteable is an Issue' do + it 'should delete a note' do + delete api("/projects/#{project.id}/issues/#{issue.id}/"\ + "notes/#{issue_note.id}", user) + expect(response.status).to eq(200) + end + + it 'should return 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) + end + end + + context 'when noteable is a Snippet' do + it 'should delete a note' do + delete api("/projects/#{project.id}/snippets/#{snippet.id}/"\ + "notes/#{snippet_note.id}", user) + expect(response.status).to eq(200) + end + + it 'should return a 404 error when note id not found' do + delete api("/projects/#{project.id}/snippets/#{snippet.id}/"\ + "notes/123", user) + expect(response.status).to eq(404) + end + end + + context 'when noteable is a Merge Request' do + it 'should delete a note' do + delete api("/projects/#{project.id}/merge_requests/"\ + "#{merge_request.id}/notes/#{merge_request_note.id}", user) + expect(response.status).to eq(200) + end + + it 'should return a 404 error when note id not found' do + delete api("/projects/#{project.id}/merge_requests/"\ + "#{merge_request.id}/notes/123", user) + expect(response.status).to eq(404) + end + end + end + end |