Commit 855c457a authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rs-empty_project-cleanup-ee' into 'master'

[EE] Ensure all project factories use `:repository` trait or `:empty_project`

See merge request !2570
parents 5060d9ed 694f84e1
...@@ -4,7 +4,7 @@ describe Admin::ApplicationSettingsController do ...@@ -4,7 +4,7 @@ describe Admin::ApplicationSettingsController do
include StubENV include StubENV
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) } let(:project) { create(:empty_project, namespace: group) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:user) { create(:user)} let(:user) { create(:user)}
......
...@@ -29,8 +29,8 @@ describe Admin::DashboardController do ...@@ -29,8 +29,8 @@ describe Admin::DashboardController do
it 'does not retrieve projects that are pending deletion' do it 'does not retrieve projects that are pending deletion' do
sign_in(create(:admin)) sign_in(create(:admin))
project = create(:project) project = create(:empty_project)
pending_delete_project = create(:project, pending_delete: true) pending_delete_project = create(:empty_project, pending_delete: true)
get :index get :index
......
...@@ -105,7 +105,7 @@ describe AutocompleteController do ...@@ -105,7 +105,7 @@ describe AutocompleteController do
end end
context 'non-member login for public project' do context 'non-member login for public project' do
let!(:project) { create(:project, :public) } let!(:project) { create(:empty_project, :public) }
before do before do
sign_in(non_member) sign_in(non_member)
...@@ -167,7 +167,7 @@ describe AutocompleteController do ...@@ -167,7 +167,7 @@ describe AutocompleteController do
end end
context 'unauthenticated user' do context 'unauthenticated user' do
let(:public_project) { create(:project, :public) } let(:public_project) { create(:empty_project, :public) }
let(:body) { JSON.parse(response.body) } let(:body) { JSON.parse(response.body) }
describe 'GET #users with public project' do describe 'GET #users with public project' do
...@@ -271,8 +271,8 @@ describe AutocompleteController do ...@@ -271,8 +271,8 @@ describe AutocompleteController do
end end
context 'GET projects' do context 'GET projects' do
let(:authorized_project) { create(:project) } let(:authorized_project) { create(:empty_project) }
let(:authorized_search_project) { create(:project, name: 'rugged') } let(:authorized_search_project) { create(:empty_project, name: 'rugged') }
before do before do
sign_in(user) sign_in(user)
...@@ -329,8 +329,8 @@ describe AutocompleteController do ...@@ -329,8 +329,8 @@ describe AutocompleteController do
context 'authorized projects apply limit' do context 'authorized projects apply limit' do
before do before do
authorized_project2 = create(:project) authorized_project2 = create(:empty_project)
authorized_project3 = create(:project) authorized_project3 = create(:empty_project)
authorized_project.add_master(user) authorized_project.add_master(user)
authorized_project2.add_master(user) authorized_project2.add_master(user)
...@@ -355,8 +355,8 @@ describe AutocompleteController do ...@@ -355,8 +355,8 @@ describe AutocompleteController do
context 'authorized projects with offset' do context 'authorized projects with offset' do
before do before do
authorized_project2 = create(:project) authorized_project2 = create(:empty_project)
authorized_project3 = create(:project) authorized_project3 = create(:empty_project)
authorized_project.add_master(user) authorized_project.add_master(user)
authorized_project2.add_master(user) authorized_project2.add_master(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe DashboardController do describe DashboardController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
before do before do
project.team << [user, :master] project.team << [user, :master]
......
...@@ -5,7 +5,7 @@ describe Groups::AnalyticsController do ...@@ -5,7 +5,7 @@ describe Groups::AnalyticsController do
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:user3) { create(:user) } let(:user3) { create(:user) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:project, group: group) } let(:project) { create(:project, :repository, group: group) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) } let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:push_data) { Gitlab::DataBuilder::Push.build_sample(project, user) } let(:push_data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
......
...@@ -78,7 +78,7 @@ describe Projects::IssuesController do ...@@ -78,7 +78,7 @@ describe Projects::IssuesController do
end end
describe 'issue weights' do describe 'issue weights' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:issue) { create(:issue, project: project, weight: 5) } let(:issue) { create(:issue, project: project, weight: 5) }
let(:issue2) { create(:issue, project: project, weight: 1) } let(:issue2) { create(:issue, project: project, weight: 1) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequests::ConflictsController do describe Projects::MergeRequests::ConflictsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:merge_request_with_conflicts) do let(:merge_request_with_conflicts) do
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequests::CreationsController do describe Projects::MergeRequests::CreationsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:user) { project.owner } let(:user) { project.owner }
let(:viewer) { user } let(:viewer) { user }
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequests::CreationsController do describe Projects::MergeRequests::CreationsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
let(:fork_project) { create(:forked_project_with_submodules) } let(:fork_project) { create(:forked_project_with_submodules) }
...@@ -83,7 +83,7 @@ describe Projects::MergeRequests::CreationsController do ...@@ -83,7 +83,7 @@ describe Projects::MergeRequests::CreationsController do
end end
context 'when the source branch is in a different project to the target' do context 'when the source branch is in a different project to the target' do
let(:other_project) { create(:project) } let(:other_project) { create(:project, :repository) }
before do before do
other_project.team << [user, :master] other_project.team << [user, :master]
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequests::DiffsController do describe Projects::MergeRequests::DiffsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
...@@ -36,7 +36,7 @@ describe Projects::MergeRequests::DiffsController do ...@@ -36,7 +36,7 @@ describe Projects::MergeRequests::DiffsController do
context 'with forked projects with submodules' do context 'with forked projects with submodules' do
render_views render_views
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:fork_project) { create(:forked_project_with_submodules) } let(:fork_project) { create(:forked_project_with_submodules) }
let(:merge_request) { create(:merge_request_with_diffs, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) } let(:merge_request) { create(:merge_request_with_diffs, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequestsController do describe Projects::MergeRequestsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:user) { project.owner } let(:user) { project.owner }
let(:viewer) { user } let(:viewer) { user }
...@@ -326,7 +326,7 @@ describe Projects::MergeRequestsController do ...@@ -326,7 +326,7 @@ describe Projects::MergeRequestsController do
end end
context 'approvals pending' do context 'approvals pending' do
let(:project) { create(:project, approvals_before_merge: 1) } let(:project) { create(:project, :repository, approvals_before_merge: 1) }
it 'returns 200' do it 'returns 200' do
expect_rebase_worker_for(viewer) expect_rebase_worker_for(viewer)
...@@ -338,7 +338,7 @@ describe Projects::MergeRequestsController do ...@@ -338,7 +338,7 @@ describe Projects::MergeRequestsController do
end end
context 'with a forked project' do context 'with a forked project' do
let(:fork_project) { create(:project, forked_from_project: project) } let(:fork_project) { create(:project, :repository, forked_from_project: project) }
let(:fork_owner) { fork_project.owner } let(:fork_owner) { fork_project.owner }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequestsController do describe Projects::MergeRequestsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:merge_request_with_conflicts) do let(:merge_request_with_conflicts) do
...@@ -191,7 +191,7 @@ describe Projects::MergeRequestsController do ...@@ -191,7 +191,7 @@ describe Projects::MergeRequestsController do
end end
context 'there is no source project' do context 'there is no source project' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:fork_project) { create(:forked_project_with_submodules) } let(:fork_project) { create(:forked_project_with_submodules) }
let(:merge_request) { create(:merge_request, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) } let(:merge_request) { create(:merge_request, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) }
...@@ -430,7 +430,7 @@ describe Projects::MergeRequestsController do ...@@ -430,7 +430,7 @@ describe Projects::MergeRequestsController do
context "when the user is owner" do context "when the user is owner" do
let(:owner) { create(:user) } let(:owner) { create(:user) }
let(:namespace) { create(:namespace, owner: owner) } let(:namespace) { create(:namespace, owner: owner) }
let(:project) { create(:project, namespace: namespace) } let(:project) { create(:project, :repository, namespace: namespace) }
before do before do
sign_in owner sign_in owner
...@@ -588,7 +588,7 @@ describe Projects::MergeRequestsController do ...@@ -588,7 +588,7 @@ describe Projects::MergeRequestsController do
describe 'GET ci_environments_status' do describe 'GET ci_environments_status' do
context 'the environment is from a forked project' do context 'the environment is from a forked project' do
let!(:forked) { create(:project) } let!(:forked) { create(:project, :repository) }
let!(:environment) { create(:environment, project: forked) } let!(:environment) { create(:environment, project: forked) }
let!(:deployment) { create(:deployment, environment: environment, sha: forked.commit.id, ref: 'master') } let!(:deployment) { create(:deployment, environment: environment, sha: forked.commit.id, ref: 'master') }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::MirrorsController do describe Projects::MirrorsController do
describe 'setting up a remote mirror' do describe 'setting up a remote mirror' do
context 'when the current project is a mirror' do context 'when the current project is a mirror' do
let(:project) { create(:project, :mirror) } let(:project) { create(:project, :repository, :mirror) }
before do before do
sign_in(project.owner) sign_in(project.owner)
...@@ -36,7 +36,7 @@ describe Projects::MirrorsController do ...@@ -36,7 +36,7 @@ describe Projects::MirrorsController do
context 'when the current project is not a mirror' do context 'when the current project is not a mirror' do
it 'allows to create a remote mirror' do it 'allows to create a remote mirror' do
project = create(:project) project = create(:project, :repository)
sign_in(project.owner) sign_in(project.owner)
expect do expect do
...@@ -46,7 +46,7 @@ describe Projects::MirrorsController do ...@@ -46,7 +46,7 @@ describe Projects::MirrorsController do
end end
context 'when the current project has a remote mirror' do context 'when the current project has a remote mirror' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:remote_mirror) { project.remote_mirrors.create!(enabled: 1, url: 'http://local.dev') } let(:remote_mirror) { project.remote_mirrors.create!(enabled: 1, url: 'http://local.dev') }
before do before do
...@@ -95,7 +95,7 @@ describe Projects::MirrorsController do ...@@ -95,7 +95,7 @@ describe Projects::MirrorsController do
end end
context 'when project does not have a mirror' do context 'when project does not have a mirror' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
it 'allows to create a mirror' do it 'allows to create a mirror' do
expect_any_instance_of(EE::Project).to receive(:force_import_job!) expect_any_instance_of(EE::Project).to receive(:force_import_job!)
...@@ -107,7 +107,7 @@ describe Projects::MirrorsController do ...@@ -107,7 +107,7 @@ describe Projects::MirrorsController do
end end
context 'when project has a mirror' do context 'when project has a mirror' do
let(:project) { create(:project, :mirror, :import_finished) } let(:project) { create(:empty_project, :mirror, :import_finished) }
it 'is able to disable the mirror' do it 'is able to disable the mirror' do
expect { do_put(project, mirror: false) }.to change { Project.mirror.count }.to(0) expect { do_put(project, mirror: false) }.to change { Project.mirror.count }.to(0)
...@@ -119,7 +119,7 @@ describe Projects::MirrorsController do ...@@ -119,7 +119,7 @@ describe Projects::MirrorsController do
it 'forces update' do it 'forces update' do
expect_any_instance_of(EE::Project).to receive(:force_import_job!) expect_any_instance_of(EE::Project).to receive(:force_import_job!)
project = create(:project, :mirror) project = create(:empty_project, :mirror)
sign_in(project.owner) sign_in(project.owner)
put :update_now, { namespace_id: project.namespace.to_param, project_id: project.to_param } put :update_now, { namespace_id: project.namespace.to_param, project_id: project.to_param }
......
...@@ -61,7 +61,7 @@ describe Projects::PipelinesController do ...@@ -61,7 +61,7 @@ describe Projects::PipelinesController do
create_build('post deploy', 3, 'pages 0') create_build('post deploy', 3, 'pages 0')
end end
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:pipeline) do let(:pipeline) do
create(:ci_empty_pipeline, project: project, user: user, sha: project.commit.id) create(:ci_empty_pipeline, project: project, user: user, sha: project.commit.id)
end end
......
...@@ -156,7 +156,7 @@ describe Projects::SnippetsController do ...@@ -156,7 +156,7 @@ describe Projects::SnippetsController do
end end
describe 'PUT #update' do describe 'PUT #update' do
let(:project) { create :project, :public } let(:project) { create :empty_project, :public }
let(:snippet) { create :project_snippet, author: user, project: project, visibility_level: visibility_level } let(:snippet) { create :project_snippet, author: user, project: project, visibility_level: visibility_level }
def update_snippet(snippet_params = {}, additional_params = {}) def update_snippet(snippet_params = {}, additional_params = {})
......
...@@ -219,7 +219,7 @@ describe ProjectsController do ...@@ -219,7 +219,7 @@ describe ProjectsController do
context "redirection from http://someproject.git" do context "redirection from http://someproject.git" do
it 'redirects to project page (format.html)' do it 'redirects to project page (format.html)' do
project = create(:project, :public) project = create(:empty_project, :public)
get :show, namespace_id: project.namespace, id: project, format: :git get :show, namespace_id: project.namespace, id: project, format: :git
...@@ -277,7 +277,7 @@ describe ProjectsController do ...@@ -277,7 +277,7 @@ describe ProjectsController do
describe '#transfer' do describe '#transfer' do
render_views render_views
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:new_namespace) { create(:namespace) } let(:new_namespace) { create(:namespace) }
...@@ -334,8 +334,8 @@ describe ProjectsController do ...@@ -334,8 +334,8 @@ describe ProjectsController do
end end
context "when the project is forked" do context "when the project is forked" do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:fork_project) { create(:project, forked_from_project: project) } let(:fork_project) { create(:project, :repository, forked_from_project: project) }
let(:merge_request) do let(:merge_request) do
create(:merge_request, create(:merge_request,
source_project: fork_project, source_project: fork_project,
...@@ -413,7 +413,7 @@ describe ProjectsController do ...@@ -413,7 +413,7 @@ describe ProjectsController do
end end
context 'with forked project' do context 'with forked project' do
let(:project_fork) { create(:project, namespace: user.namespace) } let(:project_fork) { create(:project, :repository, namespace: user.namespace) }
before do before do
create(:forked_project_link, forked_to_project: project_fork) create(:forked_project_link, forked_to_project: project_fork)
...@@ -431,7 +431,7 @@ describe ProjectsController do ...@@ -431,7 +431,7 @@ describe ProjectsController do
end end
context 'when project not forked' do context 'when project not forked' do
let(:unforked_project) { create(:project, namespace: user.namespace) } let(:unforked_project) { create(:empty_project, namespace: user.namespace) }
it 'does nothing if project was not forked' do it 'does nothing if project was not forked' do
delete(:remove_fork, delete(:remove_fork,
...@@ -453,7 +453,7 @@ describe ProjectsController do ...@@ -453,7 +453,7 @@ describe ProjectsController do
end end
describe "GET refs" do describe "GET refs" do
let(:public_project) { create(:project, :public) } let(:public_project) { create(:project, :public, :repository) }
it "gets a list of branches and tags" do it "gets a list of branches and tags" do
get :refs, namespace_id: public_project.namespace, id: public_project get :refs, namespace_id: public_project.namespace, id: public_project
......
...@@ -273,7 +273,7 @@ describe SnippetsController do ...@@ -273,7 +273,7 @@ describe SnippetsController do
end end
describe 'PUT #update' do describe 'PUT #update' do
let(:project) { create :project } let(:project) { create :empty_project }
let(:snippet) { create :personal_snippet, author: user, project: project, visibility_level: visibility_level } let(:snippet) { create :personal_snippet, author: user, project: project, visibility_level: visibility_level }
def update_snippet(snippet_params = {}, additional_params = {}) def update_snippet(snippet_params = {}, additional_params = {})
......
...@@ -26,7 +26,7 @@ describe 'GlobalSearch' do ...@@ -26,7 +26,7 @@ describe 'GlobalSearch' do
context "Respect feature visibility levels" do context "Respect feature visibility levels" do
context "Private projects" do context "Private projects" do
let(:project) { create(:project, :private) } let(:project) { create(:project, :private, :repository) }
# The feature can be disabled but the data may actually exist # The feature can be disabled but the data may actually exist
it "does not find items if features are disabled" do it "does not find items if features are disabled" do
...@@ -57,7 +57,7 @@ describe 'GlobalSearch' do ...@@ -57,7 +57,7 @@ describe 'GlobalSearch' do
end end
context "Internal projects" do context "Internal projects" do
let(:project) { create(:project, :internal) } let(:project) { create(:project, :internal, :repository) }
# The feature can be disabled but the data may actually exist # The feature can be disabled but the data may actually exist
it "does not find items if features are disabled" do it "does not find items if features are disabled" do
...@@ -101,7 +101,7 @@ describe 'GlobalSearch' do ...@@ -101,7 +101,7 @@ describe 'GlobalSearch' do
end end
context "Public projects" do context "Public projects" do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
# The feature can be disabled but the data may actually exist # The feature can be disabled but the data may actually exist
it "does not find items if features are disabled" do it "does not find items if features are disabled" do
......
FactoryGirl.define do FactoryGirl.define do
factory :upload do factory :upload do
model { build(:project) } model { build(:empty_project) }
path { "uploads/-/system/project/avatar/avatar.jpg" } path { "uploads/-/system/project/avatar/avatar.jpg" }
size 100.kilobytes size 100.kilobytes
uploader "AvatarUploader" uploader "AvatarUploader"
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe "Admin::Emails", :js do describe "Admin::Emails", :js do
let!(:current_user) { create(:admin) } let!(:current_user) { create(:admin) }
let!(:group) { create(:group) } let!(:group) { create(:group) }
let!(:project) { create(:project, namespace: group) } let!(:project) { create(:empty_project, namespace: group) }
describe "GET /admin/email" do describe "GET /admin/email" do
before do before do
......
...@@ -5,7 +5,7 @@ feature 'CI shared runner settings' do ...@@ -5,7 +5,7 @@ feature 'CI shared runner settings' do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:group) { create(:group, :with_build_minutes) } let(:group) { create(:group, :with_build_minutes) }
let!(:project) { create(:project, namespace: group, shared_runners_enabled: true) } let!(:project) { create(:empty_project, namespace: group, shared_runners_enabled: true) }
before do before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'CI shared runner limits' do feature 'CI shared runner limits' do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:project) { create(:project, namespace: group, shared_runners_enabled: true) } let!(:project) { create(:project, :repository, namespace: group, shared_runners_enabled: true) }
let(:group) { create(:group) } let(:group) { create(:group) }
before do before do
......
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
feature 'Dashboard Projects' do feature 'Dashboard Projects' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, name: 'awesome stuff') } let(:project) { create(:project, :repository, name: 'awesome stuff') }
let(:project2) { create(:project, :public, name: 'Community project') } let(:project2) { create(:empty_project, :public, name: 'Community project') }
before do before do
project.team << [user, :developer] project.team << [user, :developer]
......
...@@ -4,7 +4,7 @@ describe 'Discussion Comments Merge Request', :js do ...@@ -4,7 +4,7 @@ describe 'Discussion Comments Merge Request', :js do
include RepoHelpers include RepoHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Discussion Comments Merge Request', :js do describe 'Discussion Comments Merge Request', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Global elastic search' do feature 'Global elastic search' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:project, :repository, namespace: user.namespace) }
before do before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true) stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
feature 'Group elastic search', :js do feature 'Group elastic search', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) } let(:project) { create(:project, :repository, namespace: group) }
def choose_group(group) def choose_group(group)
find('.js-search-group-dropdown').trigger('click') find('.js-search-group-dropdown').trigger('click')
......
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
describe 'Markdown References', :js do describe 'Markdown References', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:actual_project) { create(:project, :public) } let(:actual_project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, target_project: actual_project, source_project: actual_project)} let(:merge_request) { create(:merge_request, target_project: actual_project, source_project: actual_project)}
let(:issue_actual_project) { create(:issue, project: actual_project) } let(:issue_actual_project) { create(:issue, project: actual_project) }
let!(:other_project) { create(:empty_project, :public) } let!(:other_project) { create(:empty_project, :public) }
......
...@@ -5,7 +5,7 @@ describe 'New/edit issue', :js do ...@@ -5,7 +5,7 @@ describe 'New/edit issue', :js do
include ActionView::Helpers::JavaScriptHelper include ActionView::Helpers::JavaScriptHelper
include FormHelper include FormHelper
let!(:project) { create(:project) } let!(:project) { create(:empty_project) }
let!(:user) { create(:user)} let!(:user) { create(:user)}
let!(:user2) { create(:user)} let!(:user2) { create(:user)}
let!(:milestone) { create(:milestone, project: project) } let!(:milestone) { create(:milestone, project: project) }
......
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Merge request approvals', :js do feature 'Merge request approvals', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public, approvals_before_merge: 1) } let(:project) { create(:project, :public, :repository, approvals_before_merge: 1) }
context 'when editing an MR with a different author' do context 'when editing an MR with a different author' do
let(:author) { create(:user) } let(:author) { create(:user) }
...@@ -30,7 +30,7 @@ feature 'Merge request approvals', :js do ...@@ -30,7 +30,7 @@ feature 'Merge request approvals', :js do
context 'when creating an MR from a fork' do context 'when creating an MR from a fork' do
let(:other_user) { create(:user) } let(:other_user) { create(:user) }
let(:non_member) { create(:user) } let(:non_member) { create(:user) }
let(:forked_project) { create(:project, :public, creator: user) } let(:forked_project) { create(:project, :public, :repository, creator: user) }
before do before do
create(:forked_project_link, forked_to_project: forked_project, forked_from_project: project) create(:forked_project_link, forked_to_project: forked_project, forked_from_project: project)
...@@ -269,7 +269,7 @@ feature 'Merge request approvals', :js do ...@@ -269,7 +269,7 @@ feature 'Merge request approvals', :js do
context 'when merge when discussions resolved is active', :js do context 'when merge when discussions resolved is active', :js do
let(:project) do let(:project) do
create(:project, create(:project, :repository,
approvals_before_merge: 1, approvals_before_merge: 1,
only_allow_merge_if_all_discussions_are_resolved: true) only_allow_merge_if_all_discussions_are_resolved: true)
end end
......
...@@ -87,7 +87,7 @@ feature 'Merge Request closing issues message', js: true do ...@@ -87,7 +87,7 @@ feature 'Merge Request closing issues message', js: true do
project.team << [user, :developer] project.team << [user, :developer]
end end
let(:project) { create(:project, :public, approvals_before_merge: 1) } let(:project) { create(:project, :public, :repository, approvals_before_merge: 1) }
let(:merge_request_description) { "Description\n\nclosing #{issue_1.to_reference}, #{issue_2.to_reference}" } let(:merge_request_description) { "Description\n\nclosing #{issue_1.to_reference}, #{issue_2.to_reference}" }
it 'displays closing issue message exactly one time' do it 'displays closing issue message exactly one time' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Merge With Push Rules Validation', :js do feature 'Merge With Push Rules Validation', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public, push_rule: push_rule) } let(:project) { create(:project, :public, :repository, push_rule: push_rule) }
let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: 'Bug NS-04') } let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: 'Bug NS-04') }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Squashing merge requests', :js do feature 'Squashing merge requests', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:source_branch) { 'csv' } let(:source_branch) { 'csv' }
let!(:original_head) { project.repository.commit('master') } let!(:original_head) { project.repository.commit('master') }
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
feature 'Projects > Audit Events', :js do feature 'Projects > Audit Events', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:pete) { create(:user, name: 'Pete') } let(:pete) { create(:user, name: 'Pete') }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:project, :repository, namespace: user.namespace) }
before do before do
project.team << [user, :master] project.team << [user, :master]
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
feature 'Editing file blob', js: true do feature 'Editing file blob', js: true do
include TreeHelper include TreeHelper
let(:project) { create(:project, :public, :test_repo) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'master') } let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'master') }
let(:branch) { 'master' } let(:branch) { 'master' }
let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] } let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] }
......
...@@ -354,7 +354,7 @@ feature 'Jobs' do ...@@ -354,7 +354,7 @@ feature 'Jobs' do
context 'job project is over shared runners limit' do context 'job project is over shared runners limit' do
let(:group) { create(:group, :with_used_build_minutes_limit) } let(:group) { create(:group, :with_used_build_minutes_limit) }
let(:project) { create(:project, namespace: group, shared_runners_enabled: true) } let(:project) { create(:project, :repository, namespace: group, shared_runners_enabled: true) }
it 'displays a warning message' do it 'displays a warning message' do
visit project_job_path(project, job) visit project_job_path(project, job)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Projects > Members > Member is removed from project' do feature 'Projects > Members > Member is removed from project' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
background do background do
project.team << [user, :master] project.team << [user, :master]
......
require 'spec_helper' require 'spec_helper'
feature 'Project mirror' do feature 'Project mirror' do
let(:project) { create(:project, :mirror, :import_finished, creator: user, name: 'Victorialand') } let(:project) { create(:project, :mirror, :import_finished, :repository, creator: user, name: 'Victorialand') }
let(:user) { create(:user) } let(:user) { create(:user) }
describe 'On a project', js: true do describe 'On a project', js: true do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Path Locks', :js do feature 'Path Locks', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:project, :repository, namespace: user.namespace) }
let(:tree_path) { project_tree_path(project, project.repository.root_ref) } let(:tree_path) { project_tree_path(project, project.repository.root_ref) }
before do before do
......
require 'spec_helper' require 'spec_helper'
feature 'Project remote mirror', feature: true do feature 'Project remote mirror', feature: true do
let(:project) { create(:project, :remote_mirror) } let(:project) { create(:project, :repository, :remote_mirror) }
let(:remote_mirror) { project.remote_mirrors.first } let(:remote_mirror) { project.remote_mirrors.first }
let(:user) { create(:user) } let(:user) { create(:user) }
......
...@@ -4,7 +4,7 @@ describe 'Reportable note on commit', :js do ...@@ -4,7 +4,7 @@ describe 'Reportable note on commit', :js do
include RepoHelpers include RepoHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
project.add_master(user) project.add_master(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Reportable note on merge request', :js do describe 'Reportable note on merge request', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe MembersFinder, '#execute' do describe MembersFinder, '#execute' do
let(:group) { create(:group) } let(:group) { create(:group) }
let(:nested_group) { create(:group, :access_requestable, parent: group) } let(:nested_group) { create(:group, :access_requestable, parent: group) }
let(:project) { create(:project, namespace: nested_group) } let(:project) { create(:empty_project, namespace: nested_group) }
let(:user1) { create(:user) } let(:user1) { create(:user) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:user3) { create(:user) } let(:user3) { create(:user) }
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe ButtonHelper do describe ButtonHelper do
describe 'http_clone_button' do describe 'http_clone_button' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { build_stubbed(:empty_project) }
let(:has_tooltip_class) { 'has-tooltip' } let(:has_tooltip_class) { 'has-tooltip' }
def element def element
......
...@@ -48,7 +48,7 @@ describe CiStatusHelper do ...@@ -48,7 +48,7 @@ describe CiStatusHelper do
describe "#pipeline_status_cache_key" do describe "#pipeline_status_cache_key" do
it "builds a cache key for pipeline status" do it "builds a cache key for pipeline status" do
pipeline_status = Gitlab::Cache::Ci::ProjectPipelineStatus.new( pipeline_status = Gitlab::Cache::Ci::ProjectPipelineStatus.new(
build(:project), build_stubbed(:empty_project),
pipeline_info: { pipeline_info: {
sha: "123abc", sha: "123abc",
status: "success" status: "success"
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe DiffHelper do describe DiffHelper do
include RepoHelpers include RepoHelpers
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:repository) { project.repository } let(:repository) { project.repository }
let(:commit) { project.commit(sample_commit.id) } let(:commit) { project.commit(sample_commit.id) }
let(:diffs) { commit.raw_diffs } let(:diffs) { commit.raw_diffs }
......
...@@ -180,7 +180,7 @@ describe IssuablesHelper do ...@@ -180,7 +180,7 @@ describe IssuablesHelper do
context 'when show_full_reference falsey' do context 'when show_full_reference falsey' do
context 'when @group present' do context 'when @group present' do
it 'display issuable reference to @group' do it 'display issuable reference to @group' do
project = build_stubbed(:project) project = build_stubbed(:empty_project)
assign(:show_full_reference, nil) assign(:show_full_reference, nil)
assign(:group, project.namespace) assign(:group, project.namespace)
...@@ -193,7 +193,7 @@ describe IssuablesHelper do ...@@ -193,7 +193,7 @@ describe IssuablesHelper do
context 'when @project present' do context 'when @project present' do
it 'display issuable reference to @project' do it 'display issuable reference to @project' do
project = build_stubbed(:project) project = build_stubbed(:empty_project)
assign(:show_full_reference, nil) assign(:show_full_reference, nil)
assign(:group, nil) assign(:group, nil)
......
...@@ -42,7 +42,7 @@ describe MarkupHelper do ...@@ -42,7 +42,7 @@ describe MarkupHelper do
describe "override default project" do describe "override default project" do
let(:actual) { issue.to_reference } let(:actual) { issue.to_reference }
let(:second_project) { create(:project, :public) } let(:second_project) { create(:empty_project, :public) }
let(:second_issue) { create(:issue, project: second_project) } let(:second_issue) { create(:issue, project: second_project) }
it 'links to the issue' do it 'links to the issue' do
......
...@@ -40,7 +40,7 @@ describe NotesHelper do ...@@ -40,7 +40,7 @@ describe NotesHelper do
end end
describe '#discussion_path' do describe '#discussion_path' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
context 'for a merge request discusion' do context 'for a merge request discusion' do
let(:merge_request) { create(:merge_request, source_project: project, target_project: project, importing: true) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project, importing: true) }
......
...@@ -46,7 +46,7 @@ describe ProjectsHelper do ...@@ -46,7 +46,7 @@ describe ProjectsHelper do
end end
describe "readme_cache_key" do describe "readme_cache_key" do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
helper.instance_variable_set(:@project, project) helper.instance_variable_set(:@project, project)
...@@ -64,7 +64,7 @@ describe ProjectsHelper do ...@@ -64,7 +64,7 @@ describe ProjectsHelper do
end end
describe "#project_list_cache_key", clean_gitlab_redis_shared_state: true do describe "#project_list_cache_key", clean_gitlab_redis_shared_state: true do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
it "includes the route" do it "includes the route" do
expect(helper.project_list_cache_key(project)).to include(project.route.cache_key) expect(helper.project_list_cache_key(project)).to include(project.route.cache_key)
...@@ -260,7 +260,7 @@ describe ProjectsHelper do ...@@ -260,7 +260,7 @@ describe ProjectsHelper do
end end
describe '#sanitized_import_error' do describe '#sanitized_import_error' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
allow(project).to receive(:repository_storage_path).and_return('/base/repo/path') allow(project).to receive(:repository_storage_path).and_return('/base/repo/path')
......
...@@ -18,7 +18,7 @@ describe SearchHelper do ...@@ -18,7 +18,7 @@ describe SearchHelper do
end end
it "returns parsed result" do it "returns parsed result" do
project = create :project project = create :project, :repository
project.repository.index_blobs project.repository.index_blobs
......
...@@ -4,7 +4,7 @@ describe 'Balsamiq file', '(JavaScript fixtures)', type: :controller do ...@@ -4,7 +4,7 @@ describe 'Balsamiq file', '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers include JavaScriptFixturesHelpers
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'balsamiq-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'balsamiq-project') }
before(:all) do before(:all) do
clean_frontend_fixtures('blob/balsamiq/') clean_frontend_fixtures('blob/balsamiq/')
......
...@@ -5,7 +5,7 @@ describe Dashboard::ProjectsController, '(JavaScript fixtures)', type: :controll ...@@ -5,7 +5,7 @@ describe Dashboard::ProjectsController, '(JavaScript fixtures)', type: :controll
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'builds-project') } let(:project) { create(:empty_project, namespace: namespace, path: 'builds-project') }
render_views render_views
......
...@@ -5,7 +5,7 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont ...@@ -5,7 +5,7 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'merge-requests-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') }
let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') } let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') }
let(:merged_merge_request) { create(:merge_request, :merged, source_project: project, target_project: project) } let(:merged_merge_request) { create(:merge_request, :merged, source_project: project, target_project: project) }
let(:pipeline) do let(:pipeline) do
......
...@@ -6,7 +6,7 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type ...@@ -6,7 +6,7 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'merge-requests-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') }
let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') } let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') }
let(:path) { "files/ruby/popen.rb" } let(:path) { "files/ruby/popen.rb" }
let(:position) do let(:position) do
......
...@@ -4,7 +4,7 @@ describe 'PDF file', '(JavaScript fixtures)', type: :controller do ...@@ -4,7 +4,7 @@ describe 'PDF file', '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers include JavaScriptFixturesHelpers
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'pdf-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'pdf-project') }
before(:all) do before(:all) do
clean_frontend_fixtures('blob/pdf/') clean_frontend_fixtures('blob/pdf/')
......
...@@ -5,7 +5,7 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do ...@@ -5,7 +5,7 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'builds-project') } let(:project) { create(:empty_project, namespace: namespace, path: 'builds-project') }
render_views render_views
......
...@@ -4,7 +4,7 @@ describe 'Raw files', '(JavaScript fixtures)', type: :controller do ...@@ -4,7 +4,7 @@ describe 'Raw files', '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers include JavaScriptFixturesHelpers
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'raw-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'raw-project') }
before(:all) do before(:all) do
clean_frontend_fixtures('blob/notebook/') clean_frontend_fixtures('blob/notebook/')
......
require 'spec_helper' require 'spec_helper'
describe Banzai::Filter::ReferenceFilter do describe Banzai::Filter::ReferenceFilter do
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
describe '#each_node' do describe '#each_node' do
it 'iterates over the nodes in a document' do it 'iterates over the nodes in a document' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe ContainerRegistry::Tag do describe ContainerRegistry::Tag do
let(:group) { create(:group, name: 'group') } let(:group) { create(:group, name: 'group') }
let(:project) { create(:project, path: 'test', group: group) } let(:project) { create(:project, :repository, path: 'test', group: group) }
let(:repository) do let(:repository) do
create(:container_repository, name: '', project: project) create(:container_repository, name: '', project: project)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::AuthorityAnalyzer do describe Gitlab::AuthorityAnalyzer do
describe '#calculate' do describe '#calculate' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:author) { create(:user) } let(:author) { create(:user) }
let(:user_a) { create(:user) } let(:user_a) { create(:user) }
let(:user_b) { create(:user) } let(:user_b) { create(:user) }
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Badge::Coverage::Report do describe Gitlab::Badge::Coverage::Report do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:job_name) { nil } let(:job_name) { nil }
let(:badge) do let(:badge) do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do
let!(:project) { create(:project) } let!(:project) { create(:project, :repository) }
let(:pipeline_status) { described_class.new(project) } let(:pipeline_status) { described_class.new(project) }
let(:cache_key) { "projects/#{project.id}/pipeline_status" } let(:cache_key) { "projects/#{project.id}/pipeline_status" }
...@@ -18,7 +18,7 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do ...@@ -18,7 +18,7 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do
let(:sha) { '424d1b73bc0d3cb726eb7dc4ce17a4d48552f8c6' } let(:sha) { '424d1b73bc0d3cb726eb7dc4ce17a4d48552f8c6' }
let(:ref) { 'master' } let(:ref) { 'master' }
let(:pipeline_info) { { sha: sha, status: status, ref: ref } } let(:pipeline_info) { { sha: sha, status: status, ref: ref } }
let!(:project_without_status) { create(:project) } let!(:project_without_status) { create(:project, :repository) }
describe '.load_in_batch_for_projects' do describe '.load_in_batch_for_projects' do
it 'preloads pipeline_status on projects' do it 'preloads pipeline_status on projects' do
......
...@@ -173,7 +173,7 @@ describe Gitlab::Checks::ChangeAccess do ...@@ -173,7 +173,7 @@ describe Gitlab::Checks::ChangeAccess do
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
end end
let(:project) { create(:project, :public, push_rule: push_rule) } let(:project) { create(:project, :public, :repository, push_rule: push_rule) }
before do before do
allow(project.repository).to receive(:new_commits).and_return( allow(project.repository).to receive(:new_commits).and_return(
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::CycleAnalytics::BaseEventFetcher do describe Gitlab::CycleAnalytics::BaseEventFetcher do
let(:max_events) { 2 } let(:max_events) { 2 }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user, :admin) } let(:user) { create(:user, :admin) }
let(:start_time_attrs) { Issue.arel_table[:created_at] } let(:start_time_attrs) { Issue.arel_table[:created_at] }
let(:end_time_attrs) { [Issue::Metrics.arel_table[:first_associated_with_milestone_at]] } let(:end_time_attrs) { [Issue::Metrics.arel_table[:first_associated_with_milestone_at]] }
......
require 'spec_helper' require 'spec_helper'
describe 'cycle analytics events' do describe 'cycle analytics events' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:from_date) { 10.days.ago } let(:from_date) { 10.days.ago }
let(:user) { create(:user, :admin) } let(:user) { create(:user, :admin) }
let!(:context) { create(:issue, project: project, created_at: 2.days.ago) } let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
......
...@@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca ...@@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca
end end
it "renames the route for projects of the namespace" do it "renames the route for projects of the namespace" do
project = create(:project, path: "project-path", namespace: namespace) project = create(:project, :repository, path: "project-path", namespace: namespace)
subject.rename_path_for_routable(migration_namespace(namespace)) subject.rename_path_for_routable(migration_namespace(namespace))
...@@ -120,7 +120,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca ...@@ -120,7 +120,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca
context "the-path namespace -> subgroup -> the-path0 project" do context "the-path namespace -> subgroup -> the-path0 project" do
it "updates the route of the project correctly" do it "updates the route of the project correctly" do
subgroup = create(:group, path: "subgroup", parent: namespace) subgroup = create(:group, path: "subgroup", parent: namespace)
project = create(:project, path: "the-path0", namespace: subgroup) project = create(:project, :repository, path: "the-path0", namespace: subgroup)
subject.rename_path_for_routable(migration_namespace(namespace)) subject.rename_path_for_routable(migration_namespace(namespace))
...@@ -165,7 +165,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca ...@@ -165,7 +165,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca
it 'renames all the routes for the namespace' do it 'renames all the routes for the namespace' do
child = create(:group, path: 'child', parent: namespace) child = create(:group, path: 'child', parent: namespace)
project = create(:project, namespace: child, path: 'the-project') project = create(:project, :repository, namespace: child, path: 'the-project')
other_one = create(:namespace, path: 'the-path-is-similar') other_one = create(:namespace, path: 'the-path-is-similar')
subject.perform_rename(migration_namespace(namespace), 'the-path', 'renamed') subject.perform_rename(migration_namespace(namespace), 'the-path', 'renamed')
......
...@@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
describe '#move_repositories' do describe '#move_repositories' do
let(:namespace) { create(:group, name: 'hello-group') } let(:namespace) { create(:group, name: 'hello-group') }
it 'moves a project for a namespace' do it 'moves a project for a namespace' do
create(:project, namespace: namespace, path: 'hello-project') create(:project, :repository, namespace: namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'bye-group', 'hello-project.git') expected_path = File.join(TestEnv.repos_path, 'bye-group', 'hello-project.git')
subject.move_repositories(namespace, 'hello-group', 'bye-group') subject.move_repositories(namespace, 'hello-group', 'bye-group')
...@@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
it 'moves a namespace in a subdirectory correctly' do it 'moves a namespace in a subdirectory correctly' do
child_namespace = create(:group, name: 'sub-group', parent: namespace) child_namespace = create(:group, name: 'sub-group', parent: namespace)
create(:project, namespace: child_namespace, path: 'hello-project') create(:project, :repository, namespace: child_namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'hello-group', 'renamed-sub-group', 'hello-project.git') expected_path = File.join(TestEnv.repos_path, 'hello-group', 'renamed-sub-group', 'hello-project.git')
...@@ -115,7 +115,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -115,7 +115,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
it 'moves a parent namespace with subdirectories' do it 'moves a parent namespace with subdirectories' do
child_namespace = create(:group, name: 'sub-group', parent: namespace) child_namespace = create(:group, name: 'sub-group', parent: namespace)
create(:project, namespace: child_namespace, path: 'hello-project') create(:project, :repository, namespace: child_namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'renamed-group', 'sub-group', 'hello-project.git') expected_path = File.join(TestEnv.repos_path, 'renamed-group', 'sub-group', 'hello-project.git')
subject.move_repositories(child_namespace, 'hello-group', 'renamed-group') subject.move_repositories(child_namespace, 'hello-group', 'renamed-group')
...@@ -166,7 +166,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -166,7 +166,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
describe '#rename_namespace_dependencies' do describe '#rename_namespace_dependencies' do
it "moves the the repository for a project in the namespace" do it "moves the the repository for a project in the namespace" do
create(:project, namespace: namespace, path: "the-path-project") create(:project, :repository, namespace: namespace, path: "the-path-project")
expected_repo = File.join(TestEnv.repos_path, "the-path0", "the-path-project.git") expected_repo = File.join(TestEnv.repos_path, "the-path0", "the-path-project.git")
subject.rename_namespace_dependencies(namespace, 'the-path', 'the-path0') subject.rename_namespace_dependencies(namespace, 'the-path', 'the-path0')
...@@ -243,7 +243,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -243,7 +243,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
describe '#revert_renames', redis: true do describe '#revert_renames', redis: true do
it 'renames the routes back to the previous values' do it 'renames the routes back to the previous values' do
project = create(:project, path: 'a-project', namespace: namespace) project = create(:project, :repository, path: 'a-project', namespace: namespace)
subject.rename_namespace(namespace) subject.rename_namespace(namespace)
expect(subject).to receive(:perform_rename) expect(subject).to receive(:perform_rename)
...@@ -261,7 +261,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -261,7 +261,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
end end
it 'moves the repositories back to their original place' do it 'moves the repositories back to their original place' do
project = create(:project, path: 'a-project', namespace: namespace) project = create(:project, :repository, path: 'a-project', namespace: namespace)
project.create_repository project.create_repository
subject.rename_namespace(namespace) subject.rename_namespace(namespace)
......
...@@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :tr ...@@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :tr
describe '#move_repository' do describe '#move_repository' do
let(:known_parent) { create(:namespace, path: 'known-parent') } let(:known_parent) { create(:namespace, path: 'known-parent') }
let(:project) { create(:project, path: 'the-path', namespace: known_parent) } let(:project) { create(:project, :repository, path: 'the-path', namespace: known_parent) }
it 'moves the repository for a project' do it 'moves the repository for a project' do
expected_path = File.join(TestEnv.repos_path, 'known-parent', 'new-repo.git') expected_path = File.join(TestEnv.repos_path, 'known-parent', 'new-repo.git')
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::Diff::Parser do describe Gitlab::Diff::Parser do
include RepoHelpers include RepoHelpers
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:commit) { project.commit(sample_commit.id) } let(:commit) { project.commit(sample_commit.id) }
let(:diff) { commit.raw_diffs.first } let(:diff) { commit.raw_diffs.first }
let(:parser) { described_class.new } let(:parser) { described_class.new }
......
...@@ -8,7 +8,7 @@ describe Gitlab::Elastic::Indexer do ...@@ -8,7 +8,7 @@ describe Gitlab::Elastic::Indexer do
stub_application_setting(elasticsearch_url: ['http://localhost:9200']) stub_application_setting(elasticsearch_url: ['http://localhost:9200'])
end end
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:from_sha) { Gitlab::Git::BLANK_SHA } let(:from_sha) { Gitlab::Git::BLANK_SHA }
let(:to_sha) { project.commit.try(:sha) } let(:to_sha) { project.commit.try(:sha) }
let(:indexer) { described_class.new(project) } let(:indexer) { described_class.new(project) }
...@@ -40,7 +40,7 @@ describe Gitlab::Elastic::Indexer do ...@@ -40,7 +40,7 @@ describe Gitlab::Elastic::Indexer do
end end
context 'test project' do context 'test project' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
it 'runs the indexing command' do it 'runs the indexing command' do
expect_popen.with( expect_popen.with(
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::Elastic::ProjectSearchResults do describe Gitlab::Elastic::ProjectSearchResults do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:query) { 'hello world' } let(:query) { 'hello world' }
before do before do
...@@ -34,8 +34,8 @@ describe Gitlab::Elastic::ProjectSearchResults do ...@@ -34,8 +34,8 @@ describe Gitlab::Elastic::ProjectSearchResults do
describe "search" do describe "search" do
it "returns correct amounts" do it "returns correct amounts" do
project = create :project, :public project = create :project, :public, :repository
project1 = create :project, :public project1 = create :project, :public, :repository
project.repository.index_blobs project.repository.index_blobs
project.repository.index_commits project.repository.index_commits
...@@ -81,7 +81,7 @@ describe Gitlab::Elastic::ProjectSearchResults do ...@@ -81,7 +81,7 @@ describe Gitlab::Elastic::ProjectSearchResults do
end end
describe "search for commits in non-default branch" do describe "search for commits in non-default branch" do
let(:project) { create(:project, :public, visibility) } let(:project) { create(:project, :public, :repository, visibility) }
let(:visibility) { :repository_enabled } let(:visibility) { :repository_enabled }
let(:result) { described_class.new(user, 'initial', project.id, 'test') } let(:result) { described_class.new(user, 'initial', project.id, 'test') }
......
...@@ -12,8 +12,8 @@ describe Gitlab::Elastic::SearchResults do ...@@ -12,8 +12,8 @@ describe Gitlab::Elastic::SearchResults do
end end
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project_1) { create(:project) } let(:project_1) { create(:project, :repository) }
let(:project_2) { create(:project) } let(:project_2) { create(:project, :repository) }
let(:limit_project_ids) { [project_1.id] } let(:limit_project_ids) { [project_1.id] }
describe 'issues' do describe 'issues' do
...@@ -334,7 +334,7 @@ describe Gitlab::Elastic::SearchResults do ...@@ -334,7 +334,7 @@ describe Gitlab::Elastic::SearchResults do
describe 'project scoping' do describe 'project scoping' do
it "returns items for project" do it "returns items for project" do
project = create :project, name: "term" project = create :project, :repository, name: "term"
# Create issue # Create issue
create :issue, title: 'bla-bla term', project: project create :issue, title: 'bla-bla term', project: project
...@@ -383,7 +383,7 @@ describe Gitlab::Elastic::SearchResults do ...@@ -383,7 +383,7 @@ describe Gitlab::Elastic::SearchResults do
end end
it 'finds blobs from public projects only' do it 'finds blobs from public projects only' do
project_2 = create :project, :private project_2 = create :project, :repository, :private
project_2.repository.index_blobs project_2.repository.index_blobs
Gitlab::Elastic::Helper.refresh_index Gitlab::Elastic::Helper.refresh_index
...@@ -468,7 +468,7 @@ describe Gitlab::Elastic::SearchResults do ...@@ -468,7 +468,7 @@ describe Gitlab::Elastic::SearchResults do
end end
it 'finds wiki blobs from public projects only' do it 'finds wiki blobs from public projects only' do
project_2 = create :project, :private project_2 = create :project, :repository, :private
project_2.wiki.create_page('index_page', 'term') project_2.wiki.create_page('index_page', 'term')
project_2.wiki.index_blobs project_2.wiki.index_blobs
Gitlab::Elastic::Helper.refresh_index Gitlab::Elastic::Helper.refresh_index
...@@ -486,7 +486,7 @@ describe Gitlab::Elastic::SearchResults do ...@@ -486,7 +486,7 @@ describe Gitlab::Elastic::SearchResults do
end end
context 'when wiki is disabled' do context 'when wiki is disabled' do
let(:project_1) { create(:project, :public, :wiki_disabled) } let(:project_1) { create(:project, :public, :repository, :wiki_disabled) }
context 'search by member' do context 'search by member' do
let(:limit_project_ids) { [project_1.id] } let(:limit_project_ids) { [project_1.id] }
...@@ -502,7 +502,7 @@ describe Gitlab::Elastic::SearchResults do ...@@ -502,7 +502,7 @@ describe Gitlab::Elastic::SearchResults do
end end
context 'when wiki is internal' do context 'when wiki is internal' do
let(:project_1) { create(:project, :public, :wiki_private) } let(:project_1) { create(:project, :public, :repository, :wiki_private) }
context 'search by member' do context 'search by member' do
let(:limit_project_ids) { [project_1.id] } let(:limit_project_ids) { [project_1.id] }
...@@ -534,7 +534,7 @@ describe Gitlab::Elastic::SearchResults do ...@@ -534,7 +534,7 @@ describe Gitlab::Elastic::SearchResults do
end end
it 'finds commits from public projects only' do it 'finds commits from public projects only' do
project_2 = create :project, :private project_2 = create :project, :private, :repository
project_2.repository.index_commits project_2.repository.index_commits
Gitlab::Elastic::Helper.refresh_index Gitlab::Elastic::Helper.refresh_index
...@@ -553,10 +553,10 @@ describe Gitlab::Elastic::SearchResults do ...@@ -553,10 +553,10 @@ describe Gitlab::Elastic::SearchResults do
end end
describe 'Visibility levels' do describe 'Visibility levels' do
let(:internal_project) { create(:project, :internal, description: "Internal project") } let(:internal_project) { create(:project, :internal, :repository, description: "Internal project") }
let(:private_project1) { create(:project, :private, description: "Private project") } let(:private_project1) { create(:project, :private, :repository, description: "Private project") }
let(:private_project2) { create(:project, :private, description: "Private project where I'm a member") } let(:private_project2) { create(:project, :private, :repository, description: "Private project where I'm a member") }
let(:public_project) { create(:project, :public, description: "Public project") } let(:public_project) { create(:project, :public, :repository, description: "Public project") }
let(:limit_project_ids) { [private_project2.id] } let(:limit_project_ids) { [private_project2.id] }
before do before do
......
...@@ -2,7 +2,7 @@ require "spec_helper" ...@@ -2,7 +2,7 @@ require "spec_helper"
describe Gitlab::Email::AttachmentUploader do describe Gitlab::Email::AttachmentUploader do
describe "#execute" do describe "#execute" do
let(:project) { build(:project) } let(:project) { build(:empty_project) }
let(:message_raw) { fixture_file("emails/attachment.eml") } let(:message_raw) { fixture_file("emails/attachment.eml") }
let(:message) { Mail::Message.new(message_raw) } let(:message) { Mail::Message.new(message_raw) }
......
...@@ -69,7 +69,7 @@ describe Gitlab::Email::Handler::CreateIssueHandler do ...@@ -69,7 +69,7 @@ describe Gitlab::Email::Handler::CreateIssueHandler do
end end
context "when project is private" do context "when project is private" do
let(:project) { create(:project, :private, namespace: namespace) } let(:project) { create(:empty_project, :private, namespace: namespace) }
it "raises a ProjectNotFound if the user is not a member" do it "raises a ProjectNotFound if the user is not a member" do
expect { receiver.execute }.to raise_error(Gitlab::Email::ProjectNotFound) expect { receiver.execute }.to raise_error(Gitlab::Email::ProjectNotFound)
......
...@@ -928,7 +928,7 @@ describe Gitlab::GitAccess do ...@@ -928,7 +928,7 @@ describe Gitlab::GitAccess do
end end
context 'when the repository is read only' do context 'when the repository is read only' do
let(:project) { create(:project, :read_only_repository) } let(:project) { create(:project, :repository, :read_only_repository) }
it 'denies push access' do it 'denies push access' do
project.team << [user, :master] project.team << [user, :master]
......
...@@ -207,7 +207,7 @@ describe Gitlab::GithubImport::Importer do ...@@ -207,7 +207,7 @@ describe Gitlab::GithubImport::Importer do
end end
end end
let(:project) { create(:project, :wiki_disabled, import_url: "#{repo_root}/octocat/Hello-World.git") } let(:project) { create(:project, :repository, :wiki_disabled, import_url: "#{repo_root}/octocat/Hello-World.git") }
let(:octocat) { double(id: 123456, login: 'octocat', email: 'octocat@example.com') } let(:octocat) { double(id: 123456, login: 'octocat', email: 'octocat@example.com') }
let(:credentials) { { user: 'joe' } } let(:credentials) { { user: 'joe' } }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::GithubImport::WikiFormatter do describe Gitlab::GithubImport::WikiFormatter do
let(:project) do let(:project) do
create(:project, create(:empty_project,
namespace: create(:namespace, path: 'gitlabhq'), namespace: create(:namespace, path: 'gitlabhq'),
import_url: 'https://xxx@github.com/gitlabhq/sample.gitlabhq.git') import_url: 'https://xxx@github.com/gitlabhq/sample.gitlabhq.git')
end end
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe ::Gitlab::GlRepository do describe ::Gitlab::GlRepository do
describe '.parse' do describe '.parse' do
set(:project) { create(:project) } set(:project) { create(:project, :repository) }
it 'parses a project gl_repository' do it 'parses a project gl_repository' do
expect(described_class.parse("project-#{project.id}")).to eq([project, false]) expect(described_class.parse("project-#{project.id}")).to eq([project, false])
......
...@@ -2,11 +2,11 @@ require 'spec_helper' ...@@ -2,11 +2,11 @@ require 'spec_helper'
describe 'forked project import' do describe 'forked project import' do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:project_with_repo) { create(:project, :test_repo, name: 'test-repo-restorer', path: 'test-repo-restorer') } let!(:project_with_repo) { create(:project, :repository, name: 'test-repo-restorer', path: 'test-repo-restorer') }
let!(:project) { create(:empty_project, name: 'test-repo-restorer-no-repo', path: 'test-repo-restorer-no-repo') } let!(:project) { create(:empty_project, name: 'test-repo-restorer-no-repo', path: 'test-repo-restorer-no-repo') }
let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" } let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" }
let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) } let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) }
let(:forked_from_project) { create(:project) } let(:forked_from_project) { create(:project, :repository) }
let(:fork_link) { create(:forked_project_link, forked_from_project: project_with_repo) } let(:fork_link) { create(:forked_project_link, forked_from_project: project_with_repo) }
let(:repo_saver) { Gitlab::ImportExport::RepoSaver.new(project: project_with_repo, shared: shared) } let(:repo_saver) { Gitlab::ImportExport::RepoSaver.new(project: project_with_repo, shared: shared) }
let(:bundle_path) { File.join(shared.export_path, Gitlab::ImportExport.project_bundle_filename) } let(:bundle_path) { File.join(shared.export_path, Gitlab::ImportExport.project_bundle_filename) }
......
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
describe Gitlab::ImportExport::MergeRequestParser do describe Gitlab::ImportExport::MergeRequestParser do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:project) { create(:project, :test_repo, name: 'test-repo-restorer', path: 'test-repo-restorer') } let!(:project) { create(:project, :repository, name: 'test-repo-restorer', path: 'test-repo-restorer') }
let(:forked_from_project) { create(:project) } let(:forked_from_project) { create(:project, :repository) }
let(:fork_link) { create(:forked_project_link, forked_from_project: project) } let(:fork_link) { create(:forked_project_link, forked_from_project: project) }
let!(:merge_request) do let!(:merge_request) do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::ImportExport::RepoRestorer do describe Gitlab::ImportExport::RepoRestorer do
describe 'bundle a project Git repo' do describe 'bundle a project Git repo' do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:project_with_repo) { create(:project, :test_repo, name: 'test-repo-restorer', path: 'test-repo-restorer') } let!(:project_with_repo) { create(:project, :repository, name: 'test-repo-restorer', path: 'test-repo-restorer') }
let!(:project) { create(:empty_project) } let!(:project) { create(:empty_project) }
let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" } let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" }
let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) } let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) }
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::IssuableSorter do describe Gitlab::IssuableSorter do
let(:namespace1) { build(:namespace, id: 1) } let(:namespace1) { build_stubbed(:namespace, id: 1) }
let(:project1) { build(:project, id: 1, namespace: namespace1) } let(:project1) { build_stubbed(:empty_project, id: 1, namespace: namespace1) }
let(:project2) { build(:project, id: 2, path: "a", namespace: project1.namespace) } let(:project2) { build_stubbed(:empty_project, id: 2, path: "a", namespace: project1.namespace) }
let(:project3) { build(:project, id: 3, path: "b", namespace: project1.namespace) } let(:project3) { build_stubbed(:empty_project, id: 3, path: "b", namespace: project1.namespace) }
let(:namespace2) { build(:namespace, id: 2, path: "a") } let(:namespace2) { build_stubbed(:namespace, id: 2, path: "a") }
let(:namespace3) { build(:namespace, id: 3, path: "b") } let(:namespace3) { build_stubbed(:namespace, id: 3, path: "b") }
let(:project4) { build(:project, id: 4, path: "a", namespace: namespace2) } let(:project4) { build_stubbed(:empty_project, id: 4, path: "a", namespace: namespace2) }
let(:project5) { build(:project, id: 5, path: "b", namespace: namespace2) } let(:project5) { build_stubbed(:empty_project, id: 5, path: "b", namespace: namespace2) }
let(:project6) { build(:project, id: 6, path: "a", namespace: namespace3) } let(:project6) { build_stubbed(:empty_project, id: 6, path: "a", namespace: namespace3) }
let(:unsorted) { [sorted[2], sorted[3], sorted[0], sorted[1]] } let(:unsorted) { [sorted[2], sorted[3], sorted[0], sorted[1]] }
let(:sorted) do let(:sorted) do
[build(:issue, iid: 1, project: project1), [build_stubbed(:issue, iid: 1, project: project1),
build(:issue, iid: 2, project: project1), build_stubbed(:issue, iid: 2, project: project1),
build(:issue, iid: 10, project: project1), build_stubbed(:issue, iid: 10, project: project1),
build(:issue, iid: 20, project: project1)] build_stubbed(:issue, iid: 20, project: project1)]
end end
it 'sorts references by a given key' do it 'sorts references by a given key' do
...@@ -41,14 +41,14 @@ describe Gitlab::IssuableSorter do ...@@ -41,14 +41,14 @@ describe Gitlab::IssuableSorter do
context 'for references from multiple projects and namespaces' do context 'for references from multiple projects and namespaces' do
let(:sorted) do let(:sorted) do
[build(:issue, iid: 1, project: project1), [build_stubbed(:issue, iid: 1, project: project1),
build(:issue, iid: 2, project: project1), build_stubbed(:issue, iid: 2, project: project1),
build(:issue, iid: 10, project: project1), build_stubbed(:issue, iid: 10, project: project1),
build(:issue, iid: 1, project: project2), build_stubbed(:issue, iid: 1, project: project2),
build(:issue, iid: 1, project: project3), build_stubbed(:issue, iid: 1, project: project3),
build(:issue, iid: 1, project: project4), build_stubbed(:issue, iid: 1, project: project4),
build(:issue, iid: 1, project: project5), build_stubbed(:issue, iid: 1, project: project5),
build(:issue, iid: 1, project: project6)] build_stubbed(:issue, iid: 1, project: project6)]
end end
let(:unsorted) do let(:unsorted) do
[sorted[3], sorted[1], sorted[4], sorted[2], [sorted[3], sorted[1], sorted[4], sorted[2],
......
...@@ -18,7 +18,7 @@ describe Gitlab::Middleware::Go do ...@@ -18,7 +18,7 @@ describe Gitlab::Middleware::Go do
let(:current_user) { nil } let(:current_user) { nil }
context 'with simple 2-segment project path' do context 'with simple 2-segment project path' do
let!(:project) { create(:project, :private) } let!(:project) { create(:empty_project, :private) }
context 'with subpackages' do context 'with subpackages' do
let(:path) { "#{project.full_path}/subpackage" } let(:path) { "#{project.full_path}/subpackage" }
...@@ -39,7 +39,7 @@ describe Gitlab::Middleware::Go do ...@@ -39,7 +39,7 @@ describe Gitlab::Middleware::Go do
context 'with a nested project path' do context 'with a nested project path' do
let(:group) { create(:group, :nested) } let(:group) { create(:group, :nested) }
let!(:project) { create(:project, :public, namespace: group) } let!(:project) { create(:empty_project, :public, namespace: group) }
shared_examples 'a nested project' do shared_examples 'a nested project' do
context 'when the project is public' do context 'when the project is public' do
......
...@@ -100,14 +100,14 @@ describe Gitlab::ProjectSearchResults do ...@@ -100,14 +100,14 @@ describe Gitlab::ProjectSearchResults do
end end
describe 'wiki search' do describe 'wiki search' do
let(:project) { create(:project, :public) } let(:project) { create(:empty_project, :public) }
let(:wiki) { build(:project_wiki, project: project) } let(:wiki) { build(:project_wiki, project: project) }
let!(:wiki_page) { wiki.create_page('Title', 'Content') } let!(:wiki_page) { wiki.create_page('Title', 'Content') }
subject(:results) { described_class.new(user, project, 'Content').objects('wiki_blobs') } subject(:results) { described_class.new(user, project, 'Content').objects('wiki_blobs') }
context 'when wiki is disabled' do context 'when wiki is disabled' do
let(:project) { create(:project, :public, :wiki_disabled) } let(:project) { create(:empty_project, :public, :wiki_disabled) }
it 'hides wiki blobs from members' do it 'hides wiki blobs from members' do
project.add_reporter(user) project.add_reporter(user)
...@@ -121,7 +121,7 @@ describe Gitlab::ProjectSearchResults do ...@@ -121,7 +121,7 @@ describe Gitlab::ProjectSearchResults do
end end
context 'when wiki is internal' do context 'when wiki is internal' do
let(:project) { create(:project, :public, :wiki_private) } let(:project) { create(:empty_project, :public, :wiki_private) }
it 'finds wiki blobs for guest' do it 'finds wiki blobs for guest' do
project.add_guest(user) project.add_guest(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe ::Gitlab::RepoPath do describe ::Gitlab::RepoPath do
describe '.parse' do describe '.parse' do
set(:project) { create(:project) } set(:project) { create(:project, :repository) }
context 'a repository storage path' do context 'a repository storage path' do
it 'parses a full repository path' do it 'parses a full repository path' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::UserAccess do describe Gitlab::UserAccess do
let(:access) { described_class.new(user, project: project) } let(:access) { described_class.new(user, project: project) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
describe '#can_push_to_branch?' do describe '#can_push_to_branch?' do
......
...@@ -58,7 +58,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -58,7 +58,7 @@ describe RenameSystemNamespaces, truncate: true do
end end
it "renames the route for projects of the namespace" do it "renames the route for projects of the namespace" do
project = build(:project, path: "project-path", namespace: system_namespace) project = build(:project, :repository, path: "project-path", namespace: system_namespace)
save_invalid_routable(project) save_invalid_routable(project)
migration.up migration.up
...@@ -68,7 +68,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -68,7 +68,7 @@ describe RenameSystemNamespaces, truncate: true do
it "doesn't touch routes of namespaces that look like system" do it "doesn't touch routes of namespaces that look like system" do
namespace = create(:group, path: 'systemlookalike') namespace = create(:group, path: 'systemlookalike')
project = create(:project, namespace: namespace, path: 'the-project') project = create(:project, :repository, namespace: namespace, path: 'the-project')
migration.up migration.up
...@@ -77,7 +77,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -77,7 +77,7 @@ describe RenameSystemNamespaces, truncate: true do
end end
it "moves the the repository for a project in the namespace" do it "moves the the repository for a project in the namespace" do
project = build(:project, namespace: system_namespace, path: "system-project") project = build(:project, :repository, namespace: system_namespace, path: "system-project")
save_invalid_routable(project) save_invalid_routable(project)
TestEnv.copy_repo(project, TestEnv.copy_repo(project,
bare_repo: TestEnv.factory_repo_path_bare, bare_repo: TestEnv.factory_repo_path_bare,
...@@ -105,7 +105,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -105,7 +105,7 @@ describe RenameSystemNamespaces, truncate: true do
describe "clears the markdown cache for projects in the system namespace" do describe "clears the markdown cache for projects in the system namespace" do
let!(:project) do let!(:project) do
project = build(:project, namespace: system_namespace) project = build(:project, :repository, namespace: system_namespace)
save_invalid_routable(project) save_invalid_routable(project)
project project
end end
...@@ -161,7 +161,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -161,7 +161,7 @@ describe RenameSystemNamespaces, truncate: true do
it "updates the route of the project correctly" do it "updates the route of the project correctly" do
subgroup = build(:group, path: "subgroup", parent: system_namespace) subgroup = build(:group, path: "subgroup", parent: system_namespace)
save_invalid_routable(subgroup) save_invalid_routable(subgroup)
project = build(:project, path: "system0", namespace: subgroup) project = build(:project, :repository, path: "system0", namespace: subgroup)
save_invalid_routable(project) save_invalid_routable(project)
migration.up migration.up
...@@ -174,7 +174,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -174,7 +174,7 @@ describe RenameSystemNamespaces, truncate: true do
describe "#move_repositories" do describe "#move_repositories" do
let(:namespace) { create(:group, name: "hello-group") } let(:namespace) { create(:group, name: "hello-group") }
it "moves a project for a namespace" do it "moves a project for a namespace" do
create(:project, namespace: namespace, path: "hello-project") create(:project, :repository, namespace: namespace, path: "hello-project")
expected_path = File.join(TestEnv.repos_path, "bye-group", "hello-project.git") expected_path = File.join(TestEnv.repos_path, "bye-group", "hello-project.git")
migration.move_repositories(namespace, "hello-group", "bye-group") migration.move_repositories(namespace, "hello-group", "bye-group")
...@@ -184,7 +184,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -184,7 +184,7 @@ describe RenameSystemNamespaces, truncate: true do
it "moves a namespace in a subdirectory correctly" do it "moves a namespace in a subdirectory correctly" do
child_namespace = create(:group, name: "sub-group", parent: namespace) child_namespace = create(:group, name: "sub-group", parent: namespace)
create(:project, namespace: child_namespace, path: "hello-project") create(:project, :repository, namespace: child_namespace, path: "hello-project")
expected_path = File.join(TestEnv.repos_path, "hello-group", "renamed-sub-group", "hello-project.git") expected_path = File.join(TestEnv.repos_path, "hello-group", "renamed-sub-group", "hello-project.git")
...@@ -195,7 +195,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -195,7 +195,7 @@ describe RenameSystemNamespaces, truncate: true do
it "moves a parent namespace with subdirectories" do it "moves a parent namespace with subdirectories" do
child_namespace = create(:group, name: "sub-group", parent: namespace) child_namespace = create(:group, name: "sub-group", parent: namespace)
create(:project, namespace: child_namespace, path: "hello-project") create(:project, :repository, namespace: child_namespace, path: "hello-project")
expected_path = File.join(TestEnv.repos_path, "renamed-group", "sub-group", "hello-project.git") expected_path = File.join(TestEnv.repos_path, "renamed-group", "sub-group", "hello-project.git")
migration.move_repositories(child_namespace, "hello-group", "renamed-group") migration.move_repositories(child_namespace, "hello-group", "renamed-group")
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::ComposerJson do describe BlobViewer::ComposerJson do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
{ {
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::Gemspec do describe BlobViewer::Gemspec do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
Gem::Specification.new do |s| Gem::Specification.new do |s|
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::GitlabCiYml do describe BlobViewer::GitlabCiYml do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) } let(:data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) }
let(:blob) { fake_blob(path: '.gitlab-ci.yml', data: data) } let(:blob) { fake_blob(path: '.gitlab-ci.yml', data: data) }
subject { described_class.new(blob) } subject { described_class.new(blob) }
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::PackageJson do describe BlobViewer::PackageJson do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
{ {
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::PodspecJson do describe BlobViewer::PodspecJson do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
{ {
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::Podspec do describe BlobViewer::Podspec do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
Pod::Spec.new do |spec| Pod::Spec.new do |spec|
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::RouteMap do describe BlobViewer::RouteMap do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-MAP.strip_heredoc <<-MAP.strip_heredoc
# Team data # Team data
......
...@@ -12,7 +12,7 @@ describe MergeRequest, elastic: true do ...@@ -12,7 +12,7 @@ describe MergeRequest, elastic: true do
end end
it "searches merge requests" do it "searches merge requests" do
project = create :project project = create :project, :repository
Sidekiq::Testing.inline! do Sidekiq::Testing.inline! do
create :merge_request, title: 'bla-bla term1', source_project: project create :merge_request, title: 'bla-bla term1', source_project: project
......
...@@ -65,7 +65,7 @@ describe Note, elastic: true do ...@@ -65,7 +65,7 @@ describe Note, elastic: true do
end end
it "does not create ElasticIndexerWorker job for system messages" do it "does not create ElasticIndexerWorker job for system messages" do
project = create :project project = create :project, :repository
issue = create :issue, project: project issue = create :issue, project: project
# Only issue should be updated # Only issue should be updated
......
...@@ -12,7 +12,7 @@ describe Repository, elastic: true do ...@@ -12,7 +12,7 @@ describe Repository, elastic: true do
end end
it "searches blobs and commits" do it "searches blobs and commits" do
project = create :project project = create :project, :repository
Sidekiq::Testing.inline! do Sidekiq::Testing.inline! do
project.repository.index_blobs project.repository.index_blobs
...@@ -28,8 +28,8 @@ describe Repository, elastic: true do ...@@ -28,8 +28,8 @@ describe Repository, elastic: true do
describe "class method find_commits_by_message_with_elastic" do describe "class method find_commits_by_message_with_elastic" do
it "returns commits" do it "returns commits" do
project = create :project project = create :project, :repository
project1 = create :project project1 = create :project, :repository
project.repository.index_commits project.repository.index_commits
project1.repository.index_commits project1.repository.index_commits
...@@ -44,7 +44,7 @@ describe Repository, elastic: true do ...@@ -44,7 +44,7 @@ describe Repository, elastic: true do
describe "find_commits_by_message_with_elastic" do describe "find_commits_by_message_with_elastic" do
it "returns commits" do it "returns commits" do
project = create :project project = create :project, :repository
project.repository.index_commits project.repository.index_commits
......
...@@ -13,7 +13,7 @@ describe Snippet, elastic: true do ...@@ -13,7 +13,7 @@ describe Snippet, elastic: true do
context 'searching snippets by code' do context 'searching snippets by code' do
let!(:author) { create(:user) } let!(:author) { create(:user) }
let!(:project) { create(:project) } let!(:project) { create(:empty_project) }
let!(:public_snippet) { create(:snippet, :public, content: 'password: XXX') } let!(:public_snippet) { create(:snippet, :public, content: 'password: XXX') }
let!(:internal_snippet) { create(:snippet, :internal, content: 'password: XXX') } let!(:internal_snippet) { create(:snippet, :internal, content: 'password: XXX') }
......
...@@ -24,7 +24,7 @@ describe Participable do ...@@ -24,7 +24,7 @@ describe Participable do
user1 = build(:user) user1 = build(:user)
user2 = build(:user) user2 = build(:user)
user3 = build(:user) user3 = build(:user)
project = build(:project, :public) project = build(:empty_project, :public)
instance = model.new instance = model.new
expect(instance).to receive(:foo).and_return(user2) expect(instance).to receive(:foo).and_return(user2)
...@@ -57,7 +57,7 @@ describe Participable do ...@@ -57,7 +57,7 @@ describe Participable do
other = other_model.new other = other_model.new
user1 = build(:user) user1 = build(:user)
user2 = build(:user) user2 = build(:user)
project = build(:project, :public) project = build(:empty_project, :public)
expect(instance).to receive(:foo).and_return(other) expect(instance).to receive(:foo).and_return(other)
expect(other).to receive(:bar).and_return(user2) expect(other).to receive(:bar).and_return(user2)
...@@ -69,7 +69,7 @@ describe Participable do ...@@ -69,7 +69,7 @@ describe Participable do
context 'when using a Proc as an attribute' do context 'when using a Proc as an attribute' do
it 'calls the supplied Proc' do it 'calls the supplied Proc' do
user1 = build(:user) user1 = build(:user)
project = build(:project, :public) project = build(:empty_project, :public)
user_arg = nil user_arg = nil
ext_arg = nil ext_arg = nil
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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