gitlab-org--gitlab-foss/spec/finders/groups_finder_spec.rb

34 lines
859 B
Ruby
Raw Normal View History

2016-03-01 10:22:29 -05:00
require 'spec_helper'
describe GroupsFinder do
describe '#execute' do
2016-03-18 08:28:16 -04:00
let(:user) { create(:user) }
let!(:private_group) { create(:group, :private) }
let!(:internal_group) { create(:group, :internal) }
let!(:public_group) { create(:group, :public) }
let(:finder) { described_class.new }
2016-03-01 10:22:29 -05:00
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) }
2016-03-17 18:42:46 -04:00
context 'normal user' do
it { is_expected.to eq([public_group, internal_group]) }
end
context 'external user' do
2016-03-18 08:28:16 -04:00
let(:user) { create(:user, external: true) }
2016-03-17 18:42:46 -04:00
it { is_expected.to eq([public_group]) }
end
2016-03-01 10:22:29 -05:00
end
end
end
end