Commit e93de606 authored by Ahmad Sherif's avatar Ahmad Sherif

Fix ProjectsFinder spec

Follow-up on 1003454c
parent 76db0dc1
...@@ -23,71 +23,26 @@ describe ProjectsFinder do ...@@ -23,71 +23,26 @@ describe ProjectsFinder do
let(:finder) { described_class.new } let(:finder) { described_class.new }
describe 'without a group' do describe 'without a user' do
describe 'without a user' do subject { finder.execute }
subject { finder.execute }
it { is_expected.to eq([public_project]) } it { is_expected.to eq([public_project]) }
end
describe 'with a user' do
subject { finder.execute(user) }
describe 'without private projects' do
it { is_expected.to eq([public_project, internal_project]) }
end
describe 'with private projects' do
before do
private_project.team.add_user(user, Gitlab::Access::MASTER)
end
it do
is_expected.to eq([public_project, internal_project,
private_project])
end
end
end
end end
describe 'with a group' do describe 'with a user' do
describe 'without a user' do subject { finder.execute(user) }
subject { finder.execute(nil, group: group) }
it { is_expected.to eq([public_project]) } describe 'without private projects' do
it { is_expected.to eq([public_project, internal_project]) }
end end
describe 'with a user' do describe 'with private projects' do
subject { finder.execute(user, group: group) } before do
private_project.team.add_user(user, Gitlab::Access::MASTER)
describe 'without shared projects' do
it { is_expected.to eq([public_project, internal_project]) }
end end
describe 'with shared projects and group membership' do it do
before do is_expected.to eq([public_project, internal_project, private_project])
group.add_user(user, Gitlab::Access::DEVELOPER)
shared_project.project_group_links.
create(group_access: Gitlab::Access::MASTER, group: group)
end
it do
is_expected.to eq([shared_project, public_project, internal_project])
end
end
describe 'with shared projects and project membership' do
before do
shared_project.team.add_user(user, Gitlab::Access::DEVELOPER)
shared_project.project_group_links.
create(group_access: Gitlab::Access::MASTER, group: group)
end
it do
is_expected.to eq([shared_project, public_project, internal_project])
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment