Commit 0fa1c545 authored by Robert Speicher's avatar Robert Speicher

Use `:empty_project` where possible in finder specs

parent 403cb125
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe BranchesFinder do describe BranchesFinder do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:repository) { project.repository } let(:repository) { project.repository }
describe '#execute' do describe '#execute' do
......
...@@ -6,8 +6,8 @@ describe ContributedProjectsFinder do ...@@ -6,8 +6,8 @@ describe ContributedProjectsFinder do
let(:finder) { described_class.new(source_user) } let(:finder) { described_class.new(source_user) }
let!(:public_project) { create(:project, :public) } let!(:public_project) { create(:empty_project, :public) }
let!(:private_project) { create(:project, :private) } let!(:private_project) { create(:empty_project, :private) }
before do before do
private_project.team << [source_user, Gitlab::Access::MASTER] private_project.team << [source_user, Gitlab::Access::MASTER]
......
...@@ -6,11 +6,11 @@ describe GroupProjectsFinder do ...@@ -6,11 +6,11 @@ describe GroupProjectsFinder do
let(:finder) { described_class.new(source_user) } let(:finder) { described_class.new(source_user) }
let!(:public_project) { create(:project, :public, group: group, path: '1') } let!(:public_project) { create(:empty_project, :public, group: group, path: '1') }
let!(:private_project) { create(:project, :private, group: group, path: '2') } let!(:private_project) { create(:empty_project, :private, group: group, path: '2') }
let!(:shared_project_1) { create(:project, :public, path: '3') } let!(:shared_project_1) { create(:empty_project, :public, path: '3') }
let!(:shared_project_2) { create(:project, :private, path: '4') } let!(:shared_project_2) { create(:empty_project, :private, path: '4') }
let!(:shared_project_3) { create(:project, :internal, path: '5') } let!(:shared_project_3) { create(:empty_project, :internal, path: '5') }
before do before do
shared_project_1.project_group_links.create(group_access: Gitlab::Access::MASTER, group: group) shared_project_1.project_group_links.create(group_access: Gitlab::Access::MASTER, group: group)
......
...@@ -42,7 +42,7 @@ describe JoinedGroupsFinder do ...@@ -42,7 +42,7 @@ describe JoinedGroupsFinder do
context 'if profile visitor is in one of the private group projects' do context 'if profile visitor is in one of the private group projects' do
before do before do
project = create(:project, :private, group: private_group, name: 'B', path: 'B') project = create(:empty_project, :private, group: private_group, name: 'B', path: 'B')
project.add_user(profile_visitor, Gitlab::Access::DEVELOPER) project.add_user(profile_visitor, Gitlab::Access::DEVELOPER)
end end
......
...@@ -4,9 +4,9 @@ describe MergeRequestsFinder do ...@@ -4,9 +4,9 @@ describe MergeRequestsFinder do
let(:user) { create :user } let(:user) { create :user }
let(:user2) { create :user } let(:user2) { create :user }
let(:project1) { create(:project) } let(:project1) { create(:empty_project) }
let(:project2) { create(:project, forked_from_project: project1) } let(:project2) { create(:empty_project, forked_from_project: project1) }
let(:project3) { create(:project, :archived, forked_from_project: project1) } let(:project3) { create(:empty_project, :archived, forked_from_project: project1) }
let!(:merge_request1) { create(:merge_request, :simple, author: user, source_project: project2, target_project: project1) } let!(:merge_request1) { create(:merge_request, :simple, author: user, source_project: project2, target_project: project1) }
let!(:merge_request2) { create(:merge_request, :simple, author: user, source_project: project2, target_project: project1, state: 'closed') } let!(:merge_request2) { create(:merge_request, :simple, author: user, source_project: project2, target_project: project1, state: 'closed') }
......
...@@ -28,7 +28,7 @@ describe NotesFinder do ...@@ -28,7 +28,7 @@ describe NotesFinder do
end end
it "excludes notes on commits the author can't download" do it "excludes notes on commits the author can't download" do
project = create(:project, :private) project = create(:project, :private, :repository)
note = create(:note_on_commit, project: project) note = create(:note_on_commit, project: project)
params = { target_type: 'commit', target_id: note.noteable.id } params = { target_type: 'commit', target_id: note.noteable.id }
...@@ -76,7 +76,7 @@ describe NotesFinder do ...@@ -76,7 +76,7 @@ describe NotesFinder do
end end
context 'for target' do context 'for target' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:note1) { create :note_on_commit, project: project } let(:note1) { create :note_on_commit, project: project }
let(:note2) { create :note_on_commit, project: project } let(:note2) { create :note_on_commit, project: project }
let(:commit) { note1.noteable } let(:commit) { note1.noteable }
......
...@@ -4,14 +4,14 @@ describe PersonalProjectsFinder do ...@@ -4,14 +4,14 @@ describe PersonalProjectsFinder do
let(:source_user) { create(:user) } let(:source_user) { create(:user) }
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
let(:finder) { described_class.new(source_user) } let(:finder) { described_class.new(source_user) }
let!(:public_project) { create(:project, :public, namespace: source_user.namespace) } let!(:public_project) { create(:empty_project, :public, namespace: source_user.namespace) }
let!(:private_project) do let!(:private_project) do
create(:project, :private, namespace: source_user.namespace, path: 'mepmep') create(:empty_project, :private, namespace: source_user.namespace, path: 'mepmep')
end end
let!(:internal_project) do let!(:internal_project) do
create(:project, :internal, namespace: source_user.namespace, path: 'C') create(:empty_project, :internal, namespace: source_user.namespace, path: 'C')
end end
before do before do
......
require 'spec_helper' require 'spec_helper'
describe PipelinesFinder do describe PipelinesFinder do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let!(:tag_pipeline) { create(:ci_pipeline, project: project, ref: 'v1.0.0') } let!(:tag_pipeline) { create(:ci_pipeline, project: project, ref: 'v1.0.0') }
let!(:branch_pipeline) { create(:ci_pipeline, project: project) } let!(:branch_pipeline) { create(:ci_pipeline, project: project) }
......
...@@ -6,19 +6,19 @@ describe ProjectsFinder do ...@@ -6,19 +6,19 @@ describe ProjectsFinder do
let(:group) { create(:group, :public) } let(:group) { create(:group, :public) }
let!(:private_project) do let!(:private_project) do
create(:project, :private, name: 'A', path: 'A') create(:empty_project, :private, name: 'A', path: 'A')
end end
let!(:internal_project) do let!(:internal_project) do
create(:project, :internal, group: group, name: 'B', path: 'B') create(:empty_project, :internal, group: group, name: 'B', path: 'B')
end end
let!(:public_project) do let!(:public_project) do
create(:project, :public, group: group, name: 'C', path: 'C') create(:empty_project, :public, group: group, name: 'C', path: 'C')
end end
let!(:shared_project) do let!(:shared_project) do
create(:project, :private, name: 'D', path: 'D') create(:empty_project, :private, name: 'D', path: 'D')
end end
let(:finder) { described_class.new } let(:finder) { described_class.new }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe TagsFinder do describe TagsFinder do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:repository) { project.repository } let(:repository) { project.repository }
describe '#execute' do describe '#execute' do
......
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