summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-11-13 11:24:01 +0000
committerSean McGivern <sean@gitlab.com>2017-11-13 13:19:54 +0000
commitcf6ff601656b4de368cc9fe17543e8d611368a46 (patch)
tree7a8c3727353cf9fc5725c1d117d026312e3a8068 /spec/finders
parent95661d7b6220d6b0608f2582b3a89b5b743c1b0e (diff)
downloadgitlab-ce-cf6ff601656b4de368cc9fe17543e8d611368a46.tar.gz
Fix users autocomplete in a subgroup
We should include users who have access from parent groups, not just direct members of the current group.
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/autocomplete_users_finder_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/finders/autocomplete_users_finder_spec.rb b/spec/finders/autocomplete_users_finder_spec.rb
index 684af74d750..dcf9111776e 100644
--- a/spec/finders/autocomplete_users_finder_spec.rb
+++ b/spec/finders/autocomplete_users_finder_spec.rb
@@ -42,6 +42,21 @@ describe AutocompleteUsersFinder do
it { is_expected.to match_array([user1]) }
end
+ context 'when passed a subgroup', :nested_groups do
+ let(:grandparent) { create(:group, :public) }
+ let(:parent) { create(:group, :public, parent: grandparent) }
+ let(:child) { create(:group, :public, parent: parent) }
+ let(:group) { parent }
+
+ let!(:grandparent_user) { create(:group_member, :developer, group: grandparent).user }
+ let!(:parent_user) { create(:group_member, :developer, group: parent).user }
+ let!(:child_user) { create(:group_member, :developer, group: child).user }
+
+ it 'includes users from parent groups as well' do
+ expect(subject).to match_array([grandparent_user, parent_user])
+ end
+ end
+
it { is_expected.to match_array([user1, external_user, omniauth_user, current_user]) }
context 'when filtered by search' do