diff options
Diffstat (limited to 'spec/finders/notes_finder_spec.rb')
-rw-r--r-- | spec/finders/notes_finder_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index 11de19cfdbc..61be90b267a 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -328,6 +328,16 @@ RSpec.describe NotesFinder do it 'returns the commit' do expect(subject.target).to eq(commit) end + + context 'user does not have permission to read_code' do + before do + allow(Ability).to receive(:allowed?).with(user, :read_code, project).and_return false + end + + it 'returns nil' do + expect(subject.target).to be_nil + end + end end context 'target_iid' do |