diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-06-27 17:35:35 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-06-28 15:50:29 -0300 |
commit | da3e4f412846b754d31439da0d884181653bced0 (patch) | |
tree | e1c6da18204cf5c7990c350c5b9c01501ff60192 /spec/models/namespace_spec.rb | |
parent | 9f44687a14d57fec596b9736584bf8718df75a2e (diff) | |
download | gitlab-ce-da3e4f412846b754d31439da0d884181653bced0.tar.gz |
Add "members_count" and "parent_id" data on namespaces API
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r-- | spec/models/namespace_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index e7c3acf19eb..d4f898f6d9f 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -323,6 +323,25 @@ describe Namespace, models: true do end end + describe '#users_with_descendants', :nested_groups do + let(:user_a) { create(:user) } + let(:user_b) { create(:user) } + + let(:group) { create(:group) } + let(:nested_group) { create(:group, parent: group) } + let(:deep_nested_group) { create(:group, parent: nested_group) } + + it 'returns member users on every nest level without duplication' do + group.add_developer(user_a) + nested_group.add_developer(user_b) + deep_nested_group.add_developer(user_a) + + expect(group.users_with_descendants).to contain_exactly(user_a, user_b) + expect(nested_group.users_with_descendants).to contain_exactly(user_a, user_b) + expect(deep_nested_group.users_with_descendants).to contain_exactly(user_a) + end + end + describe '#user_ids_for_project_authorizations' do it 'returns the user IDs for which to refresh authorizations' do expect(namespace.user_ids_for_project_authorizations) |