diff options
author | Rémy Coutable <remy@rymai.me> | 2017-11-13 18:15:11 +0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-11-14 19:16:05 +0300 |
commit | ba6a53f8f3be2d31de0449de23a4bb69f228ed62 (patch) | |
tree | ac1d03f18d687696f41582f7ec7f2f315428cd26 /spec | |
parent | 19d6cdfe1b374fce6119a85a6e221d9e354dc0e3 (diff) |
Merge branch 'fix-subgroup-autocomplete' into 'master'
Fix users autocomplete in a subgroup
Closes #39452
See merge request gitlab-org/gitlab-ce!15350
(cherry picked from commit 4a1e8188f96744103e51263c9bdc071c8e088690)
cf6ff601 Fix users autocomplete in a subgroup
Diffstat (limited to 'spec')
-rw-r--r-- | spec/finders/autocomplete_users_finder_spec.rb | 15 |
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 |