summaryrefslogtreecommitdiff
path: root/spec/policies
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 00:09:12 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-25 00:09:12 +0000
commit0b881f91159cc97ccb7328a2e52977a60ea83fbe (patch)
treed6b683cb935112aee47121f46e3c5dc84de24f2c /spec/policies
parent7671216b60e2796a050358ff808b4a0c2de3d22f (diff)
downloadgitlab-ce-0b881f91159cc97ccb7328a2e52977a60ea83fbe.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-rw-r--r--spec/policies/project_snippet_policy_spec.rb48
1 files changed, 35 insertions, 13 deletions
diff --git a/spec/policies/project_snippet_policy_spec.rb b/spec/policies/project_snippet_policy_spec.rb
index b55d565a57c..c5077e119bc 100644
--- a/spec/policies/project_snippet_policy_spec.rb
+++ b/spec/policies/project_snippet_policy_spec.rb
@@ -20,28 +20,39 @@ describe ProjectSnippetPolicy do
subject { described_class.new(current_user, snippet) }
shared_examples 'regular user access rights' do
- context 'project team member (non guest)' do
- before do
- project.add_developer(current_user)
- end
+ context 'not snippet author' do
+ context 'project team member (non guest)' do
+ before do
+ project.add_developer(current_user)
+ end
- it do
- expect_allowed(:read_snippet, :create_note)
- expect_disallowed(*author_permissions)
+ it do
+ expect_allowed(:read_snippet, :create_note)
+ expect_disallowed(*author_permissions)
+ end
end
- end
- context 'project team member (guest)' do
- before do
- project.add_guest(current_user)
- end
+ context 'project team member (guest)' do
+ before do
+ project.add_guest(current_user)
+ end
- context 'not snippet author' do
it do
expect_allowed(:read_snippet, :create_note)
expect_disallowed(:admin_snippet)
end
end
+
+ context 'project team member (maintainer)' do
+ before do
+ project.add_maintainer(current_user)
+ end
+
+ it do
+ expect_allowed(:read_snippet, :create_note)
+ expect_allowed(*author_permissions)
+ end
+ end
end
context 'snippet author' do
@@ -69,6 +80,17 @@ describe ProjectSnippetPolicy do
end
end
+ context 'project team member (maintainer)' do
+ before do
+ project.add_maintainer(current_user)
+ end
+
+ it do
+ expect_allowed(:read_snippet, :create_note)
+ expect_allowed(*author_permissions)
+ end
+ end
+
context 'not a project member' do
it do
expect_allowed(:read_snippet, :create_note)