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

33 lines
880 B
Ruby
Raw Normal View History

2015-11-26 14:37:03 +05:30
require 'spec_helper'
describe ContributedProjectsFinder do
let(:source_user) { create(:user) }
let(:current_user) { create(:user) }
let(:finder) { described_class.new(source_user) }
2017-09-10 17:25:29 +05:30
let!(:public_project) { create(:project, :public) }
let!(:private_project) { create(:project, :private) }
2015-11-26 14:37:03 +05:30
before do
2017-08-17 22:00:37 +05:30
private_project.add_master(source_user)
private_project.add_developer(current_user)
public_project.add_master(source_user)
2015-11-26 14:37:03 +05:30
2017-09-10 17:25:29 +05:30
create(:push_event, project: public_project, author: source_user)
create(:push_event, project: private_project, author: source_user)
2015-11-26 14:37:03 +05:30
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