Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-10 14:33:02 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-10 15:09:56 +0300
commitdeb45634ae841d64d1756c4cc0dc3c442e171ba9 (patch)
tree13827a92872cbc43a2b41e90998562d416c2a147 /spec/finders
parent524f65152fde2591a52d4c58d14c643ce379ec5b (diff)
Use `EXISTS` instead of `WHERE id IN (...)` for authorized groups
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/group_descendants_finder_spec.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/finders/group_descendants_finder_spec.rb b/spec/finders/group_descendants_finder_spec.rb
index 86a7a793457..1aef49613ee 100644
--- a/spec/finders/group_descendants_finder_spec.rb
+++ b/spec/finders/group_descendants_finder_spec.rb
@@ -39,7 +39,7 @@ describe GroupDescendantsFinder do
context 'with nested groups', :nested_groups do
let!(:project) { create(:project, namespace: group) }
- let!(:subgroup) { create(:group, parent: group) }
+ let!(:subgroup) { create(:group, :private, parent: group) }
describe '#execute' do
it 'contains projects and subgroups' do
@@ -59,6 +59,15 @@ describe GroupDescendantsFinder do
expect(finder.execute).to contain_exactly(public_subgroup, other_subgroup)
end
+ it 'only includes public groups when no user is given' do
+ public_subgroup = create(:group, :public, parent: group)
+ _private_subgroup = create(:group, :private, parent: group)
+
+ finder = described_class.new(current_user: nil, parent_group: group)
+
+ expect(finder.execute).to contain_exactly(public_subgroup)
+ end
+
context 'with a filter' do
let(:params) { { filter: 'test' } }
@@ -86,7 +95,7 @@ describe GroupDescendantsFinder do
context 'with matching children' do
it 'includes a group that has a subgroup matching the query and its parent' do
- matching_subgroup = create(:group, name: 'testgroup', parent: subgroup)
+ matching_subgroup = create(:group, :private, name: 'testgroup', parent: subgroup)
expect(finder.execute).to contain_exactly(subgroup, matching_subgroup)
end