summaryrefslogtreecommitdiff
path: root/spec/controllers/projects/notes_controller_spec.rb
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-05-03 13:03:57 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-05-03 13:03:57 +0100
commit7788118c3d059ef93bcc49c1b6b6ec7d72faf8b5 (patch)
tree6642a358083285d90234f8d4ba27d61bfd9448bd /spec/controllers/projects/notes_controller_spec.rb
parent637ed8a21e9f9457d1b194f9c591a0813c20cc3e (diff)
parentcac04fbd777ff992bbd92e9ae3cded01d45b07d0 (diff)
downloadgitlab-ce-7788118c3d059ef93bcc49c1b6b6ec7d72faf8b5.tar.gz
Merge remote-tracking branch 'origin/master' into add-sentry-js-again-with-vue
Diffstat (limited to 'spec/controllers/projects/notes_controller_spec.rb')
-rw-r--r--spec/controllers/projects/notes_controller_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb
index f140eaef5d5..45f4cf9180d 100644
--- a/spec/controllers/projects/notes_controller_spec.rb
+++ b/spec/controllers/projects/notes_controller_spec.rb
@@ -167,6 +167,47 @@ describe Projects::NotesController do
end
end
+ describe 'DELETE destroy' do
+ let(:request_params) do
+ {
+ namespace_id: project.namespace,
+ project_id: project,
+ id: note,
+ format: :js
+ }
+ end
+
+ context 'user is the author of a note' do
+ before do
+ sign_in(note.author)
+ project.team << [note.author, :developer]
+ end
+
+ it "returns status 200 for html" do
+ delete :destroy, request_params
+
+ expect(response).to have_http_status(200)
+ end
+
+ it "deletes the note" do
+ expect { delete :destroy, request_params }.to change { Note.count }.from(1).to(0)
+ end
+ end
+
+ context 'user is not the author of a note' do
+ before do
+ sign_in(user)
+ project.team << [user, :developer]
+ end
+
+ it "returns status 404" do
+ delete :destroy, request_params
+
+ expect(response).to have_http_status(404)
+ end
+ end
+ end
+
describe 'POST toggle_award_emoji' do
before do
sign_in(user)