diff options
author | Robert Speicher <robert@gitlab.com> | 2018-05-02 22:11:45 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-05-02 22:11:45 +0300 |
commit | ab6dd3ac57dfff6472f6ecac21154fada9aa8d65 (patch) | |
tree | 36273df1ba7754757a2eb34454d61fd64c40a55a /spec/policies/group_policy_spec.rb | |
parent | b01221cc9e02c09fa259a5c4c71eb559e77816fe (diff) | |
parent | 9ec4b5c9b65f40a71ca94d2f318da4adf9309a2e (diff) |
Merge branch '10-7-stable-patch-3' into '10-7-stable'
Prepare 10.7.3 release
See merge request gitlab-org/gitlab-ce!18647
Diffstat (limited to 'spec/policies/group_policy_spec.rb')
-rw-r--r-- | spec/policies/group_policy_spec.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/spec/policies/group_policy_spec.rb b/spec/policies/group_policy_spec.rb index b4d25e06d9a..9b5c290b9f9 100644 --- a/spec/policies/group_policy_spec.rb +++ b/spec/policies/group_policy_spec.rb @@ -7,9 +7,9 @@ describe GroupPolicy do let(:master) { create(:user) } let(:owner) { create(:user) } let(:admin) { create(:admin) } - let(:group) { create(:group) } + let(:group) { create(:group, :private) } - let(:guest_permissions) { [:read_group, :upload_file, :read_namespace] } + let(:guest_permissions) { [:read_label, :read_group, :upload_file, :read_namespace] } let(:reporter_permissions) { [:admin_label] } @@ -50,6 +50,7 @@ describe GroupPolicy do end context 'with no user' do + let(:group) { create(:group, :public) } let(:current_user) { nil } it do @@ -63,6 +64,28 @@ describe GroupPolicy do end end + context 'has projects' do + let(:current_user) { create(:user) } + let(:project) { create(:project, namespace: group) } + + before do + project.add_developer(current_user) + end + + it do + expect_allowed(:read_group, :read_label) + end + + context 'in subgroups', :nested_groups do + let(:subgroup) { create(:group, :private, parent: group) } + let(:project) { create(:project, namespace: subgroup) } + + it do + expect_allowed(:read_group, :read_label) + end + end + end + context 'guests' do let(:current_user) { guest } |