debian-mirror-gitlab/spec/finders/personal_projects_finder_spec.rb

35 lines
862 B
Ruby
Raw Normal View History

2015-11-26 14:37:03 +05:30
require 'spec_helper'
describe PersonalProjectsFinder do
let(:source_user) { create(:user) }
let(:current_user) { create(:user) }
let(:finder) { described_class.new(source_user) }
let!(:public_project) do
create(:project, :public, namespace: source_user.namespace, name: 'A',
path: 'A')
end
let!(:private_project) do
create(:project, :private, namespace: source_user.namespace, name: 'B',
path: 'B')
end
before do
private_project.team << [current_user, Gitlab::Access::DEVELOPER]
end
describe 'without a current user' do
subject { finder.execute }
it { is_expected.to eq([public_project]) }
end
describe 'with a current user' do
subject { finder.execute(current_user) }
it { is_expected.to eq([private_project, public_project]) }
end
end