diff options
author | Toon Claes <toon@gitlab.com> | 2017-05-29 15:01:10 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-05-29 21:50:51 +0300 |
commit | 86145951ca01a1abab30a257a986f19bfa6a66bf (patch) | |
tree | de22fb79a416bcf7f87063b702f0370864496d84 /spec | |
parent | 821daf709f522b386dcd347bd339dd9d948233fe (diff) |
Show private subgroups if member of parent group
If the user is member of one of the parent groups, also private groups should be
shown.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/finders/groups_finder_spec.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/finders/groups_finder_spec.rb b/spec/finders/groups_finder_spec.rb index 5b3591550c1..6ba86cf1a5f 100644 --- a/spec/finders/groups_finder_spec.rb +++ b/spec/finders/groups_finder_spec.rb @@ -51,15 +51,31 @@ describe GroupsFinder do end context 'with a user' do + subject { described_class.new(user, parent: parent_group).execute } + it 'returns public and internal subgroups' do - expect(described_class.new(user, parent: parent_group).execute).to contain_exactly(public_subgroup, internal_subgroup) + is_expected.to contain_exactly(public_subgroup, internal_subgroup) end context 'being member' do it 'returns public subgroups, internal subgroups, and private subgroups user is member of' do private_subgroup.add_guest(user) - expect(described_class.new(user, parent: parent_group).execute).to contain_exactly(public_subgroup, internal_subgroup, private_subgroup) + is_expected.to contain_exactly(public_subgroup, internal_subgroup, private_subgroup) + end + end + + context 'parent group private' do + before do + parent_group.update_attribute(:visibility_level, Gitlab::VisibilityLevel::PRIVATE) + end + + context 'being member of parent group' do + it 'returns all subgroups' do + parent_group.add_guest(user) + + is_expected.to contain_exactly(public_subgroup, internal_subgroup, private_subgroup) + end end end end |