summaryrefslogtreecommitdiff
path: root/spec/controllers/projects
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2017-11-01 16:50:05 -0200
committerFelipe Artur <felipefac@gmail.com>2017-11-03 11:26:25 -0200
commit3ae5f7900cb222499948eedc982a1830a7402c3c (patch)
treef62c6f4e00584378ed07391ed11280f4538cd4fd /spec/controllers/projects
parentbfb5107ae720232a15060ee55feba213ee7dd097 (diff)
downloadgitlab-ce-3ae5f7900cb222499948eedc982a1830a7402c3c.tar.gz
Render 404 when polling commit notes without having permissionsissue_39176
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/notes_controller_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb
index 1184c55e540..43afcc14957 100644
--- a/spec/controllers/projects/notes_controller_spec.rb
+++ b/spec/controllers/projects/notes_controller_spec.rb
@@ -105,6 +105,19 @@ describe Projects::NotesController do
expect(note_json[:discussion_html]).to be_nil
expect(note_json[:diff_discussion_html]).to be_nil
end
+
+ context 'when user cannot read commit' do
+ before do
+ allow(Ability).to receive(:allowed?).and_call_original
+ allow(Ability).to receive(:allowed?).with(user, :download_code, project).and_return(false)
+ end
+
+ it 'renders 404' do
+ get :index, params
+
+ expect(response).to have_gitlab_http_status(404)
+ end
+ end
end
end