diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-11-03 20:51:13 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-11-03 20:51:13 +0300 |
commit | 3971f9556d7f6fc3fcf68a8020d99033b0569604 (patch) | |
tree | 386fd60103715842086911eb402f334f84121ada /spec | |
parent | 539dbef04e2111ea6e36c7392dbe634173ece55f (diff) | |
parent | 3ae5f7900cb222499948eedc982a1830a7402c3c (diff) |
Merge branch 'issue_39176' into 'master'
Render 404 when polling commit notes without having permissions
Closes #39176
See merge request gitlab-org/gitlab-ce!15140
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/notes_controller_spec.rb | 13 |
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 |