summaryrefslogtreecommitdiff
path: root/spec/finders
diff options
context:
space:
mode:
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/groups_finder_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/finders/groups_finder_spec.rb b/spec/finders/groups_finder_spec.rb
new file mode 100644
index 00000000000..ed24954af7a
--- /dev/null
+++ b/spec/finders/groups_finder_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe GroupsFinder do
+ describe '#execute' do
+ let(:user) { create(:user) }
+ let!(:private_group) { create(:group, visibility_level: 0) }
+ let!(:internal_group) { create(:group, visibility_level: 10) }
+ let!(:public_group) { create(:group, visibility_level: 20) }
+ let(:finder) { described_class.new }
+
+ describe 'execute' do
+ describe 'without a user' do
+ subject { finder.execute }
+
+ it { is_expected.to eq([public_group]) }
+ end
+
+ describe 'with a user' do
+ subject { finder.execute(user) }
+
+ it { is_expected.to eq([public_group, internal_group]) }
+ end
+ end
+ end
+end