summaryrefslogtreecommitdiff
path: root/spec/models/group_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/models/group_spec.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r--spec/models/group_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index d6e76258491..93cb6d83489 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -662,6 +662,19 @@ describe Group do
expect(group.members_with_parents).to include(developer)
expect(group.members_with_parents).to include(maintainer)
end
+
+ context 'group sharing' do
+ let!(:shared_group) { create(:group) }
+
+ before do
+ create(:group_group_link, shared_group: shared_group, shared_with_group: group)
+ end
+
+ it 'returns shared with group members' do
+ expect(shared_group.members_with_parents).to(
+ include(developer))
+ end
+ end
end
describe '#members_from_self_and_ancestors_with_effective_access_level' do
@@ -800,6 +813,22 @@ describe Group do
expect(group.user_ids_for_project_authorizations)
.to include(maintainer.id, developer.id)
end
+
+ context 'group sharing' do
+ let_it_be(:group) { create(:group) }
+ let_it_be(:group_user) { create(:user) }
+ let_it_be(:shared_group) { create(:group) }
+
+ before do
+ group.add_developer(group_user)
+ create(:group_group_link, shared_group: shared_group, shared_with_group: group)
+ end
+
+ it 'returns the user IDs for shared with group members' do
+ expect(shared_group.user_ids_for_project_authorizations).to(
+ include(group_user.id))
+ end
+ end
end
describe '#update_two_factor_requirement' do