diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-17 18:06:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-17 18:06:17 +0300 |
commit | 238d22c07218adf2b8f3db630ee8b74ca6f29df5 (patch) | |
tree | 23fd5f85efef0fb95eb73bf6395d5b7e8c0f1b9f /spec/models/group_spec.rb | |
parent | 6b75320f525f841454f1ab162d141d3610f2e77b (diff) |
Add latest changes from gitlab-org/gitlab@masterlist
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r-- | spec/models/group_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 892c31a9204..520421ac5e3 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -1042,4 +1042,21 @@ describe Group do expect(group.access_request_approvers_to_be_notified).to eq(active_owners_in_recent_sign_in_desc_order) end end + + describe '.groups_including_descendants_by' do + it 'returns the expected groups for a group and its descendants' do + parent_group1 = create(:group) + child_group1 = create(:group, parent: parent_group1) + child_group2 = create(:group, parent: parent_group1) + + parent_group2 = create(:group) + child_group3 = create(:group, parent: parent_group2) + + create(:group) + + groups = described_class.groups_including_descendants_by([parent_group2.id, parent_group1.id]) + + expect(groups).to contain_exactly(parent_group1, parent_group2, child_group1, child_group2, child_group3) + end + end end |