summaryrefslogtreecommitdiff
path: root/spec/policies
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 21:09:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 21:09:16 +0000
commit154b9bae142ba15fec753f44327654595094b879 (patch)
tree027f8ae024961778d5b00c77a72fe302f985d4f3 /spec/policies
parent2c156e3c7bbade01c36eee18327f1ced6eebea79 (diff)
downloadgitlab-ce-154b9bae142ba15fec753f44327654595094b879.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-rw-r--r--spec/policies/note_policy_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/policies/note_policy_spec.rb b/spec/policies/note_policy_spec.rb
index e480fc2a642..94e6a86025c 100644
--- a/spec/policies/note_policy_spec.rb
+++ b/spec/policies/note_policy_spec.rb
@@ -35,6 +35,18 @@ describe NotePolicy do
end
end
+ context 'when the noteable is a deleted commit' do
+ let(:commit) { nil }
+ let(:note) { create(:note_on_commit, commit_id: '12345678', author: user, project: project) }
+
+ it 'allows to read' do
+ expect(policy).to be_allowed(:read_note)
+ expect(policy).to be_disallowed(:admin_note)
+ expect(policy).to be_disallowed(:resolve_note)
+ expect(policy).to be_disallowed(:award_emoji)
+ end
+ end
+
context 'when the noteable is a commit' do
let(:commit) { project.repository.head_commit }
let(:note) { create(:note_on_commit, commit_id: commit.id, author: user, project: project) }