diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-24 12:09:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-24 12:09:44 +0300 |
commit | b1b7c2f9a744197a111c81719c546a474adab4e8 (patch) | |
tree | 2fe9d392110fb1fee8a8e6eac1f520425fee1c9c /spec/policies | |
parent | 81c305759174e2f55176356e98d264ea1c4b747d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/global_policy_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/policies/global_policy_spec.rb b/spec/policies/global_policy_spec.rb index 5e77b64a408..ac7f5db980c 100644 --- a/spec/policies/global_policy_spec.rb +++ b/spec/policies/global_policy_spec.rb @@ -80,6 +80,34 @@ describe GlobalPolicy do end end + describe 'create group' do + context 'when user has the ability to create group' do + let(:current_user) { create(:user, can_create_group: true) } + + it { is_expected.to be_allowed(:create_group) } + end + + context 'when user does not have the ability to create group' do + let(:current_user) { create(:user, can_create_group: false) } + + it { is_expected.not_to be_allowed(:create_group) } + end + end + + describe 'create group with default branch protection' do + context 'when user has the ability to create group' do + let(:current_user) { create(:user, can_create_group: true) } + + it { is_expected.to be_allowed(:create_group_with_default_branch_protection) } + end + + context 'when user does not have the ability to create group' do + let(:current_user) { create(:user, can_create_group: false) } + + it { is_expected.not_to be_allowed(:create_group_with_default_branch_protection) } + end + end + describe 'custom attributes' do context 'regular user' do it { is_expected.not_to be_allowed(:read_custom_attribute) } |