From 8c3a03c1b9bf5c80571c9dc07ba258fa10dd61c8 Mon Sep 17 00:00:00 2001 From: Jarka Kadlecova Date: Thu, 27 Apr 2017 12:41:26 +0200 Subject: Display comments for personal snippets --- spec/controllers/projects/notes_controller_spec.rb | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'spec/controllers/projects/notes_controller_spec.rb') 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) -- cgit v1.2.1