summaryrefslogtreecommitdiff
path: root/spec/finders/groups_finder_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/finders/groups_finder_spec.rb')
-rw-r--r--spec/finders/groups_finder_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/finders/groups_finder_spec.rb b/spec/finders/groups_finder_spec.rb
index 939b818f165..78764f79a6c 100644
--- a/spec/finders/groups_finder_spec.rb
+++ b/spec/finders/groups_finder_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe GroupsFinder do
+RSpec.describe GroupsFinder do
describe '#execute' do
let(:user) { create(:user) }
@@ -74,6 +74,12 @@ describe GroupsFinder do
let!(:internal_subgroup) { create(:group, :internal, parent: parent_group) }
let!(:private_subgroup) { create(:group, :private, parent: parent_group) }
+ context 'with [nil] parent' do
+ it 'returns only top-level groups' do
+ expect(described_class.new(user, parent: [nil]).execute).to contain_exactly(parent_group)
+ end
+ end
+
context 'without a user' do
it 'only returns parent and public subgroups' do
expect(described_class.new(nil).execute).to contain_exactly(parent_group, public_subgroup)