Commit dc39c837 authored by Robert Schilling's avatar Robert Schilling

Adapt tests to new testing guidelines

parent 49484f9a
......@@ -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
......
......@@ -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)
......
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment