diff options
author | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2018-12-11 14:05:49 +0100 |
---|---|---|
committer | Alexis Reigel <alexis.reigel.ext@siemens.com> | 2019-03-14 18:21:02 +0100 |
commit | 3b01d23af0a17e269bbd39eab0d54b55d9b84b3e (patch) | |
tree | d22468f4d25d48330b7cfe6cf7204f0081c13401 /spec/lib | |
parent | 241f38b01d6ba3fdbed0a1f8b74b354441d79fb2 (diff) | |
download | gitlab-ce-3b01d23af0a17e269bbd39eab0d54b55d9b84b3e.tar.gz |
spec for group's user search incl. parent group
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/group_search_results_spec.rb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/spec/lib/gitlab/group_search_results_spec.rb b/spec/lib/gitlab/group_search_results_spec.rb index a9f94038524..02245ca88dc 100644 --- a/spec/lib/gitlab/group_search_results_spec.rb +++ b/spec/lib/gitlab/group_search_results_spec.rb @@ -15,7 +15,9 @@ describe Gitlab::GroupSearchResults do create(:user, username: 'gob_2018') - expect(described_class.new(user, anything, group, 'gob').objects('users')).to eq [user1] + result = described_class.new(user, anything, group, 'gob').objects('users') + + expect(result).to eq [user1] end it 'returns the user belonging to the subgroup matching the search query', :nested_groups do @@ -25,7 +27,21 @@ describe Gitlab::GroupSearchResults do create(:user, username: 'gob_2018') - expect(described_class.new(user, anything, group, 'gob').objects('users')).to eq [user1] + result = described_class.new(user, anything, group, 'gob').objects('users') + + expect(result).to eq [user1] + end + + it 'returns the user belonging to the parent group matching the search query', :nested_groups do + user1 = create(:user, username: 'gob_bluth') + parent_group = create(:group, children: [group]) + create(:group_member, :developer, user: user1, group: parent_group) + + create(:user, username: 'gob_2018') + + result = described_class.new(user, anything, group, 'gob').objects('users') + + expect(result).to eq [user1] end it 'does not return the user belonging to the private subgroup', :nested_groups do @@ -35,7 +51,9 @@ describe Gitlab::GroupSearchResults do create(:user, username: 'gob_2018') - expect(described_class.new(user, anything, group, 'gob').objects('users')).to eq [] + result = described_class.new(user, anything, group, 'gob').objects('users') + + expect(result).to eq [] end end end |