diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index ba9497a32827359d481795ea3c540d5e6c9b7379..9e0f1f5bc923e84642e58e9d048f1d8709759bf4 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -4,7 +4,7 @@ include StubENV let(:group) { create(:group) } - let(:project) { create(:project, namespace: group) } + let(:project) { create(:empty_project, namespace: group) } let(:admin) { create(:admin) } let(:user) { create(:user)} diff --git a/spec/controllers/admin/dashboard_controller_spec.rb b/spec/controllers/admin/dashboard_controller_spec.rb index 0bff5d73b12a8979bffcb4c0f2486b149d7ae62e..3a49c22341e2d9971d8d9b814bc44c3c080f26e6 100644 --- a/spec/controllers/admin/dashboard_controller_spec.rb +++ b/spec/controllers/admin/dashboard_controller_spec.rb @@ -29,8 +29,8 @@ it 'does not retrieve projects that are pending deletion' do sign_in(create(:admin)) - project = create(:project) - pending_delete_project = create(:project, pending_delete: true) + project = create(:empty_project) + pending_delete_project = create(:empty_project, pending_delete: true) get :index diff --git a/spec/controllers/autocomplete_controller_spec.rb b/spec/controllers/autocomplete_controller_spec.rb index 23ec243992462e862381ccf903d743f4816d856c..c4ad008a6a61a2ca634d55a9dc6603dc279574b4 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -105,7 +105,7 @@ end context 'non-member login for public project' do - let!(:project) { create(:project, :public) } + let!(:project) { create(:empty_project, :public) } before do sign_in(non_member) @@ -167,7 +167,7 @@ end context 'unauthenticated user' do - let(:public_project) { create(:project, :public) } + let(:public_project) { create(:empty_project, :public) } let(:body) { JSON.parse(response.body) } describe 'GET #users with public project' do @@ -271,8 +271,8 @@ end context 'GET projects' do - let(:authorized_project) { create(:project) } - let(:authorized_search_project) { create(:project, name: 'rugged') } + let(:authorized_project) { create(:empty_project) } + let(:authorized_search_project) { create(:empty_project, name: 'rugged') } before do sign_in(user) @@ -329,8 +329,8 @@ context 'authorized projects apply limit' do before do - authorized_project2 = create(:project) - authorized_project3 = create(:project) + authorized_project2 = create(:empty_project) + authorized_project3 = create(:empty_project) authorized_project.add_master(user) authorized_project2.add_master(user) @@ -355,8 +355,8 @@ context 'authorized projects with offset' do before do - authorized_project2 = create(:project) - authorized_project3 = create(:project) + authorized_project2 = create(:empty_project) + authorized_project3 = create(:empty_project) authorized_project.add_master(user) authorized_project2.add_master(user) diff --git a/spec/controllers/dashboard_controller_spec.rb b/spec/controllers/dashboard_controller_spec.rb index 566d85151982a19d55df311ee0f6dc5d5bf84eee..05561946e9be35053a02ad1489545056bc763f9f 100644 --- a/spec/controllers/dashboard_controller_spec.rb +++ b/spec/controllers/dashboard_controller_spec.rb @@ -2,7 +2,7 @@ describe DashboardController do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:empty_project) } before do project.team << [user, :master] diff --git a/spec/controllers/groups/analytics_controller_spec.rb b/spec/controllers/groups/analytics_controller_spec.rb index 533f69361bf8305eafa5781762cd2e2317406f4e..c2b12d864ade27eeb73cf46f65b3220407451cb0 100644 --- a/spec/controllers/groups/analytics_controller_spec.rb +++ b/spec/controllers/groups/analytics_controller_spec.rb @@ -5,7 +5,7 @@ let(:user2) { create(:user) } let(:user3) { create(:user) } let(:group) { create(:group) } - let(:project) { create(:project, group: group) } + let(:project) { create(:project, :repository, group: group) } let(:issue) { create(:issue, project: project) } let(:merge_request) { create(:merge_request, :simple, source_project: project) } let(:push_data) { Gitlab::DataBuilder::Push.build_sample(project, user) } diff --git a/spec/controllers/projects/issues_controller_ee_spec.rb b/spec/controllers/projects/issues_controller_ee_spec.rb index 5286730943b22875ff10a3cbcf3ff3a7df4423c9..c51e4b79501ce5b64446c1f6b7b3c1df889b38c7 100644 --- a/spec/controllers/projects/issues_controller_ee_spec.rb +++ b/spec/controllers/projects/issues_controller_ee_spec.rb @@ -78,7 +78,7 @@ def request_csv end describe 'issue weights' do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } let(:user) { create(:user) } let(:issue) { create(:issue, project: project, weight: 5) } let(:issue2) { create(:issue, project: project, weight: 1) } diff --git a/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb b/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb index 9278ac8edd88309f328a5dcc9ee3c6f25a5dec94..393d38c6e6bab0c23c61c1d9c5da0768ecb7f048 100644 --- a/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb +++ b/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Projects::MergeRequests::ConflictsController do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:user) { project.owner } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request_with_conflicts) do diff --git a/spec/controllers/projects/merge_requests/creations_controller_ee_spec.rb b/spec/controllers/projects/merge_requests/creations_controller_ee_spec.rb index 0c730ec53a94c94b34a9a55a6d0029862b5063f4..ce6a6de9d2a5afbf91d7fe0259f554bbfdc7e669 100644 --- a/spec/controllers/projects/merge_requests/creations_controller_ee_spec.rb +++ b/spec/controllers/projects/merge_requests/creations_controller_ee_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' 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(:user) { project.owner } let(:viewer) { user } diff --git a/spec/controllers/projects/merge_requests/creations_controller_spec.rb b/spec/controllers/projects/merge_requests/creations_controller_spec.rb index f9d8f0f5fcfe5fde0bff277cabf8158c025da48c..fc4cec533747ac037ba2dfd774221c65493a9ea6 100644 --- a/spec/controllers/projects/merge_requests/creations_controller_spec.rb +++ b/spec/controllers/projects/merge_requests/creations_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Projects::MergeRequests::CreationsController do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:user) { project.owner } let(:fork_project) { create(:forked_project_with_submodules) } @@ -83,7 +83,7 @@ def diff_for_path(extra_params = {}) end 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 other_project.team << [user, :master] diff --git a/spec/controllers/projects/merge_requests/diffs_controller_spec.rb b/spec/controllers/projects/merge_requests/diffs_controller_spec.rb index 53fe2bdb189bcab806f35bf68b5b231fe272057b..fd6cb3c5dbbd4e7d75254a0a01930567ae21f553 100644 --- a/spec/controllers/projects/merge_requests/diffs_controller_spec.rb +++ b/spec/controllers/projects/merge_requests/diffs_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Projects::MergeRequests::DiffsController do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:user) { project.owner } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } @@ -36,7 +36,7 @@ def go(extra_params = {}) context 'with forked projects with submodules' do render_views - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } 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) } diff --git a/spec/controllers/projects/merge_requests_controller_ee_spec.rb b/spec/controllers/projects/merge_requests_controller_ee_spec.rb index 1cf88c72b1fe893bf3a30b0e69395c1a5f8810da..833db2dc771cebc331e556857cb39bd4cf4a402a 100644 --- a/spec/controllers/projects/merge_requests_controller_ee_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_ee_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' 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(:user) { project.owner } let(:viewer) { user } @@ -326,7 +326,7 @@ def expect_rebase_worker_for(user) end 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 expect_rebase_worker_for(viewer) @@ -338,7 +338,7 @@ def expect_rebase_worker_for(user) end 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 } before do diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 7274a6d3fd8293cdf44cf650652e3f72022f9a2d..ae7f269cb138837604c5d1bd76ca0b88e8b23deb 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Projects::MergeRequestsController do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:user) { project.owner } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request_with_conflicts) do @@ -191,7 +191,7 @@ def get_merge_requests(page = nil) end 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(: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 @@ def merge_when_pipeline_succeeds context "when the user is owner" do let(:owner) { create(:user) } let(:namespace) { create(:namespace, owner: owner) } - let(:project) { create(:project, namespace: namespace) } + let(:project) { create(:project, :repository, namespace: namespace) } before do sign_in owner @@ -588,7 +588,7 @@ def post_assign_issues describe 'GET ci_environments_status' 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!(:deployment) { create(:deployment, environment: environment, sha: forked.commit.id, ref: 'master') } let(:admin) { create(:admin) } diff --git a/spec/controllers/projects/mirrors_controller_spec.rb b/spec/controllers/projects/mirrors_controller_spec.rb index e4647273c6033d4b36af7db4fc1c91afeb2ff506..19766c996af23b0d501f3349e30bd79e192db42f 100644 --- a/spec/controllers/projects/mirrors_controller_spec.rb +++ b/spec/controllers/projects/mirrors_controller_spec.rb @@ -3,7 +3,7 @@ describe Projects::MirrorsController do describe 'setting up a remote mirror' do context 'when the current project is a mirror' do - let(:project) { create(:project, :mirror) } + let(:project) { create(:project, :repository, :mirror) } before do sign_in(project.owner) @@ -36,7 +36,7 @@ context 'when the current project is not a mirror' do it 'allows to create a remote mirror' do - project = create(:project) + project = create(:project, :repository) sign_in(project.owner) expect do @@ -46,7 +46,7 @@ end 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') } before do @@ -95,7 +95,7 @@ end 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 expect_any_instance_of(EE::Project).to receive(:force_import_job!) @@ -107,7 +107,7 @@ end 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 expect { do_put(project, mirror: false) }.to change { Project.mirror.count }.to(0) @@ -119,7 +119,7 @@ it 'forces update' do expect_any_instance_of(EE::Project).to receive(:force_import_job!) - project = create(:project, :mirror) + project = create(:empty_project, :mirror) sign_in(project.owner) put :update_now, { namespace_id: project.namespace.to_param, project_id: project.to_param } diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index c8de275ca3e2e800a9e6ada9883a2e1bc9a6c940..ed63e4dec262caa6fad25e8a9e83d924d6b196a1 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -61,7 +61,7 @@ create_build('post deploy', 3, 'pages 0') end - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:pipeline) do create(:ci_empty_pipeline, project: project, user: user, sha: project.commit.id) end diff --git a/spec/controllers/projects/snippets_controller_spec.rb b/spec/controllers/projects/snippets_controller_spec.rb index cc444f317979291e68b66c05820ce9fefffbe4c7..1f082ce7102b07ca700cd1a46aad779b272fd68e 100644 --- a/spec/controllers/projects/snippets_controller_spec.rb +++ b/spec/controllers/projects/snippets_controller_spec.rb @@ -156,7 +156,7 @@ def create_snippet(project, snippet_params = {}, additional_params = {}) end 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 } def update_snippet(snippet_params = {}, additional_params = {}) diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 5068212396d0a2ba63afe5f166b7ea2c72214516..4b005c66bd906776bd7fcc180ad03db7b4975a61 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -219,7 +219,7 @@ context "redirection from http://someproject.git" 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 @@ -277,7 +277,7 @@ def update_project(**parameters) describe '#transfer' do render_views - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:admin) { create(:admin) } let(:new_namespace) { create(:namespace) } @@ -334,8 +334,8 @@ def update_project(**parameters) end context "when the project is forked" do - let(:project) { create(:project) } - let(:fork_project) { create(:project, forked_from_project: project) } + let(:project) { create(:project, :repository) } + let(:fork_project) { create(:project, :repository, forked_from_project: project) } let(:merge_request) do create(:merge_request, source_project: fork_project, @@ -413,7 +413,7 @@ def update_project(**parameters) end context 'with forked project' do - let(:project_fork) { create(:project, namespace: user.namespace) } + let(:project_fork) { create(:project, :repository, namespace: user.namespace) } before do create(:forked_project_link, forked_to_project: project_fork) @@ -431,7 +431,7 @@ def update_project(**parameters) end 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 delete(:remove_fork, @@ -453,7 +453,7 @@ def update_project(**parameters) end 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 get :refs, namespace_id: public_project.namespace, id: public_project diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb index 475ceda11feb42172da83013b7e82a3437aebcc7..a6edcca08f47cd828b26dbb3d78d3dda585a42a0 100644 --- a/spec/controllers/snippets_controller_spec.rb +++ b/spec/controllers/snippets_controller_spec.rb @@ -273,7 +273,7 @@ def create_snippet(snippet_params = {}, additional_params = {}) end 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 } def update_snippet(snippet_params = {}, additional_params = {}) diff --git a/spec/elastic_integration/global_search_spec.rb b/spec/elastic_integration/global_search_spec.rb index be34eafc1c79d4c1e1b46c5f093a56b94d1ba576..9bf994ec3357041fdc4d067e177d82a2758f97d4 100644 --- a/spec/elastic_integration/global_search_spec.rb +++ b/spec/elastic_integration/global_search_spec.rb @@ -26,7 +26,7 @@ context "Respect feature visibility levels" 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 it "does not find items if features are disabled" do @@ -57,7 +57,7 @@ end 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 it "does not find items if features are disabled" do @@ -101,7 +101,7 @@ end 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 it "does not find items if features are disabled" do diff --git a/spec/factories/uploads.rb b/spec/factories/uploads.rb index 3222c41c3d8977801dd6da546955063ebf8b3221..f49dbe6dc9efbd657ec51843f11f4907eb0d5ec8 100644 --- a/spec/factories/uploads.rb +++ b/spec/factories/uploads.rb @@ -1,6 +1,6 @@ FactoryGirl.define do factory :upload do - model { build(:project) } + model { build(:empty_project) } path { "uploads/-/system/project/avatar/avatar.jpg" } size 100.kilobytes uploader "AvatarUploader" diff --git a/spec/features/admin/admin_emails_spec.rb b/spec/features/admin/admin_emails_spec.rb index fd3e4ea5c6e1950b24b7fb2238dd5b178308ac75..336c874cf46e601179e7c713cf134139bf0b8b18 100644 --- a/spec/features/admin/admin_emails_spec.rb +++ b/spec/features/admin/admin_emails_spec.rb @@ -3,7 +3,7 @@ describe "Admin::Emails", :js do let!(:current_user) { create(:admin) } let!(:group) { create(:group) } - let!(:project) { create(:project, namespace: group) } + let!(:project) { create(:empty_project, namespace: group) } describe "GET /admin/email" do before do diff --git a/spec/features/ci_shared_runner_settings_spec.rb b/spec/features/ci_shared_runner_settings_spec.rb index 062d6e5e5318d900bc43760a366ba197552269b5..03628968854eec4b9a8550818bcdba03959c8558 100644 --- a/spec/features/ci_shared_runner_settings_spec.rb +++ b/spec/features/ci_shared_runner_settings_spec.rb @@ -5,7 +5,7 @@ let(:admin) { create(:admin) } 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 stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') diff --git a/spec/features/ci_shared_runner_warnings_spec.rb b/spec/features/ci_shared_runner_warnings_spec.rb index 4591f969ca0427e18caa8daff2b15a249a49e5ea..5fdde74a0f4c866336949b58f33ef454f1f70321 100644 --- a/spec/features/ci_shared_runner_warnings_spec.rb +++ b/spec/features/ci_shared_runner_warnings_spec.rb @@ -2,7 +2,7 @@ feature 'CI shared runner limits' do 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) } before do diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index abb9e5eef96576a77df149d440ae037066bca8b7..29ac96adc0ea8dc2c9898f0470b8ba2ee5e70908 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -2,8 +2,8 @@ feature 'Dashboard Projects' do let(:user) { create(:user) } - let(:project) { create(:project, name: 'awesome stuff') } - let(:project2) { create(:project, :public, name: 'Community project') } + let(:project) { create(:project, :repository, name: 'awesome stuff') } + let(:project2) { create(:empty_project, :public, name: 'Community project') } before do project.team << [user, :developer] diff --git a/spec/features/discussion_comments/commit_spec.rb b/spec/features/discussion_comments/commit_spec.rb index fa83ad5d17cd2812ca82639b3dd3bca49224f579..0375d0bf8ff1f3cdb4657545721bb0ca2d20b60b 100644 --- a/spec/features/discussion_comments/commit_spec.rb +++ b/spec/features/discussion_comments/commit_spec.rb @@ -4,7 +4,7 @@ include RepoHelpers let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } before do diff --git a/spec/features/discussion_comments/merge_request_spec.rb b/spec/features/discussion_comments/merge_request_spec.rb index 042f39f47e077acd06b2d693df4cfa20bc3b3a61..b0019c32189ed3dbd059d6f7dd8d5cd5796d48e3 100644 --- a/spec/features/discussion_comments/merge_request_spec.rb +++ b/spec/features/discussion_comments/merge_request_spec.rb @@ -2,7 +2,7 @@ describe 'Discussion Comments Merge Request', :js do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } before do diff --git a/spec/features/es_global_search_spec.rb b/spec/features/es_global_search_spec.rb index 4901fad6465551b4e560eb2414223c2e2240596d..8504191ef6f1bf070c8a6e8c86dafb9e2e6e11eb 100644 --- a/spec/features/es_global_search_spec.rb +++ b/spec/features/es_global_search_spec.rb @@ -2,7 +2,7 @@ feature 'Global elastic search' do let(:user) { create(:user) } - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :repository, namespace: user.namespace) } before do stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true) diff --git a/spec/features/es_group_search_spec.rb b/spec/features/es_group_search_spec.rb index dd6a974f1dd85344dd68d0ae3b08adb92830ba55..348eb42e51d9e8bda8e8578954c4fd1d8813dd73 100644 --- a/spec/features/es_group_search_spec.rb +++ b/spec/features/es_group_search_spec.rb @@ -3,7 +3,7 @@ feature 'Group elastic search', :js do let(:user) { create(:user) } let(:group) { create(:group) } - let(:project) { create(:project, namespace: group) } + let(:project) { create(:project, :repository, namespace: group) } def choose_group(group) find('.js-search-group-dropdown').trigger('click') diff --git a/spec/features/issuables/markdown_references_spec.rb b/spec/features/issuables/markdown_references_spec.rb index 169381d703ab482d168d0ab24406f7b445273806..04d38165a15bf3b7846cf58949fa6c39b8306b4c 100644 --- a/spec/features/issuables/markdown_references_spec.rb +++ b/spec/features/issuables/markdown_references_spec.rb @@ -2,7 +2,7 @@ describe 'Markdown References', :js do 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(:issue_actual_project) { create(:issue, project: actual_project) } let!(:other_project) { create(:empty_project, :public) } diff --git a/spec/features/issues/ee/form_spec.rb b/spec/features/issues/ee/form_spec.rb index bd8995ba4c48ed7e3c848f0dc287d18d277b759d..5fb9163093ea083bae4cc03a2f514a1b9afc4c04 100644 --- a/spec/features/issues/ee/form_spec.rb +++ b/spec/features/issues/ee/form_spec.rb @@ -5,7 +5,7 @@ include ActionView::Helpers::JavaScriptHelper include FormHelper - let!(:project) { create(:project) } + let!(:project) { create(:empty_project) } let!(:user) { create(:user)} let!(:user2) { create(:user)} let!(:milestone) { create(:milestone, project: project) } diff --git a/spec/features/merge_requests/approvals_spec.rb b/spec/features/merge_requests/approvals_spec.rb index 6a1d8b298b118dac8e5766b038ae996d585b53b1..00e2ab52cef7b067f0dbb64ef5c0c928d56baae1 100644 --- a/spec/features/merge_requests/approvals_spec.rb +++ b/spec/features/merge_requests/approvals_spec.rb @@ -2,7 +2,7 @@ feature 'Merge request approvals', :js do 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 let(:author) { create(:user) } @@ -30,7 +30,7 @@ context 'when creating an MR from a fork' do let(:other_user) { 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 create(:forked_project_link, forked_to_project: forked_project, forked_from_project: project) @@ -269,7 +269,7 @@ context 'when merge when discussions resolved is active', :js do let(:project) do - create(:project, + create(:project, :repository, approvals_before_merge: 1, only_allow_merge_if_all_discussions_are_resolved: true) end diff --git a/spec/features/merge_requests/closes_issues_spec.rb b/spec/features/merge_requests/closes_issues_spec.rb index 40bc7c0165146117746e379040b437d61098f9ac..56d50e07774271f45769e8f6c13df50e93f867ae 100644 --- a/spec/features/merge_requests/closes_issues_spec.rb +++ b/spec/features/merge_requests/closes_issues_spec.rb @@ -87,7 +87,7 @@ project.team << [user, :developer] 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}" } it 'displays closing issue message exactly one time' do diff --git a/spec/features/merge_requests/merge_with_push_rules_spec.rb b/spec/features/merge_requests/merge_with_push_rules_spec.rb index abe9e08ee0d489e1591fa916aa91b266517d4f22..885d97b65aa387eafd67479bb3a70cdcc18ca85a 100644 --- a/spec/features/merge_requests/merge_with_push_rules_spec.rb +++ b/spec/features/merge_requests/merge_with_push_rules_spec.rb @@ -2,7 +2,7 @@ feature 'Merge With Push Rules Validation', :js do 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') } before do diff --git a/spec/features/merge_requests/squash_spec.rb b/spec/features/merge_requests/squash_spec.rb index f6e95dab962065979a59cd40c52b6f71bdc8b8b0..6572c8d976ea4b917ac92c9395957d4d79a613ba 100644 --- a/spec/features/merge_requests/squash_spec.rb +++ b/spec/features/merge_requests/squash_spec.rb @@ -2,7 +2,7 @@ feature 'Squashing merge requests', :js do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:source_branch) { 'csv' } let!(:original_head) { project.repository.commit('master') } diff --git a/spec/features/projects/audit_events_spec.rb b/spec/features/projects/audit_events_spec.rb index ea3eef2a7c0d659a84c6070b60d5e56508da25c3..bb364e56343446e4060b0076dfb059eb06ca35b6 100644 --- a/spec/features/projects/audit_events_spec.rb +++ b/spec/features/projects/audit_events_spec.rb @@ -3,7 +3,7 @@ feature 'Projects > Audit Events', :js do let(:user) { create(:user) } let(:pete) { create(:user, name: 'Pete') } - let(:project) { create(:project, namespace: user.namespace) } + let(:project) { create(:project, :repository, namespace: user.namespace) } before do project.team << [user, :master] diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 93fb41d0001811d09bb7ef5ce47846609978e017..62ac9fd0e9556d2196821861ee3e4300bcb29b86 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -3,7 +3,7 @@ feature 'Editing file blob', js: true do 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(:branch) { 'master' } let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] } diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 9aadb486bb78fa385184469b95d5ebf21dc8093c..0477f3501e417af3311f22a49b232b16846918e9 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -354,7 +354,7 @@ context 'job project is over shared runners limit' do 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 visit project_job_path(project, job) diff --git a/spec/features/projects/members/member_is_removed_from_project_spec.rb b/spec/features/projects/members/member_is_removed_from_project_spec.rb index 51371390ff636d7e7c96481d0c3d2ef7793d0fec..697a66bfab365aabb791f52b1987ed4e6d5f95b4 100644 --- a/spec/features/projects/members/member_is_removed_from_project_spec.rb +++ b/spec/features/projects/members/member_is_removed_from_project_spec.rb @@ -2,7 +2,7 @@ feature 'Projects > Members > Member is removed from project' do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:empty_project) } background do project.team << [user, :master] diff --git a/spec/features/projects/mirror_spec.rb b/spec/features/projects/mirror_spec.rb index 8503c349d4abccf4c7301010ccfc949f2eab7704..d1dac2ef0c94d49ac194e5f8d683c4f7cbd76fad 100644 --- a/spec/features/projects/mirror_spec.rb +++ b/spec/features/projects/mirror_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' 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) } describe 'On a project', js: true do diff --git a/spec/features/projects/path_locks_spec.rb b/spec/features/projects/path_locks_spec.rb index 3d7554a5d842e293f4e78e1001bdc1ce9128e2df..127c87cca007db0e5f42b02b0f6ee80f72a447ee 100644 --- a/spec/features/projects/path_locks_spec.rb +++ b/spec/features/projects/path_locks_spec.rb @@ -2,7 +2,7 @@ feature 'Path Locks', :js do 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) } before do diff --git a/spec/features/projects/remote_mirror_spec.rb b/spec/features/projects/remote_mirror_spec.rb index ad9a09fbdc92471f05fe11006abb4240e9b87088..1297c16a8284937ab8f2dda5d7dea5a7821db63c 100644 --- a/spec/features/projects/remote_mirror_spec.rb +++ b/spec/features/projects/remote_mirror_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' 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(:user) { create(:user) } diff --git a/spec/features/reportable_note/commit_spec.rb b/spec/features/reportable_note/commit_spec.rb index 1074eb62b33746b5c6eb847be0d9f34652d766a2..3bf25221e36de01a86dc90d98a3f6210f0abfb07 100644 --- a/spec/features/reportable_note/commit_spec.rb +++ b/spec/features/reportable_note/commit_spec.rb @@ -4,7 +4,7 @@ include RepoHelpers let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } before do project.add_master(user) diff --git a/spec/features/reportable_note/merge_request_spec.rb b/spec/features/reportable_note/merge_request_spec.rb index a491abdb6cb9bcf273def571eee12bc125355fd3..bb296546e068205f6b1b62d4e540f2e9c0b81126 100644 --- a/spec/features/reportable_note/merge_request_spec.rb +++ b/spec/features/reportable_note/merge_request_spec.rb @@ -2,7 +2,7 @@ describe 'Reportable note on merge request', :js do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } before do diff --git a/spec/finders/members_finder_spec.rb b/spec/finders/members_finder_spec.rb index 300ba8422e883d572647f6609407f2c4157bb12e..9fb9ffa95e79491bf6b6c82a38ae06f93fd5fb36 100644 --- a/spec/finders/members_finder_spec.rb +++ b/spec/finders/members_finder_spec.rb @@ -3,7 +3,7 @@ describe MembersFinder, '#execute' do let(:group) { create(: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(:user2) { create(:user) } let(:user3) { create(:user) } diff --git a/spec/helpers/button_helper_spec.rb b/spec/helpers/button_helper_spec.rb index 7ecb75da8ce5d4fe677b9e8e83f8627825f465ca..7c6f3b101d7a7d434c4795fb979e7d9b5135e686 100644 --- a/spec/helpers/button_helper_spec.rb +++ b/spec/helpers/button_helper_spec.rb @@ -3,7 +3,7 @@ describe ButtonHelper do describe 'http_clone_button' do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { build_stubbed(:empty_project) } let(:has_tooltip_class) { 'has-tooltip' } def element diff --git a/spec/helpers/ci_status_helper_spec.rb b/spec/helpers/ci_status_helper_spec.rb index e6bb953e9d81e56b2222e294be9cfda460cbce5a..3f8df388014c763aef82882d5b7bb63692ab31d5 100644 --- a/spec/helpers/ci_status_helper_spec.rb +++ b/spec/helpers/ci_status_helper_spec.rb @@ -48,7 +48,7 @@ describe "#pipeline_status_cache_key" do it "builds a cache key for pipeline status" do pipeline_status = Gitlab::Cache::Ci::ProjectPipelineStatus.new( - build(:project), + build_stubbed(:empty_project), pipeline_info: { sha: "123abc", status: "success" diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb index 0d909e6e1400f2b21d5bc0dc488155667eb20910..f5f151b4923553e03b9259ecbcc319f421126d8f 100644 --- a/spec/helpers/diff_helper_spec.rb +++ b/spec/helpers/diff_helper_spec.rb @@ -3,7 +3,7 @@ describe DiffHelper do include RepoHelpers - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:repository) { project.repository } let(:commit) { project.commit(sample_commit.id) } let(:diffs) { commit.raw_diffs } diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index 7789cfa3554a8dfbbaee9d902a148567363a8fc7..1aad8a85ab7ae640e7b534271f8b7852cf843f13 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -180,7 +180,7 @@ context 'when show_full_reference falsey' do context 'when @group present' do it 'display issuable reference to @group' do - project = build_stubbed(:project) + project = build_stubbed(:empty_project) assign(:show_full_reference, nil) assign(:group, project.namespace) @@ -193,7 +193,7 @@ context 'when @project present' do it 'display issuable reference to @project' do - project = build_stubbed(:project) + project = build_stubbed(:empty_project) assign(:show_full_reference, nil) assign(:group, nil) diff --git a/spec/helpers/markup_helper_spec.rb b/spec/helpers/markup_helper_spec.rb index 70eb01c9c44dea0156fc6a39d40e735dbc611df4..6dfffb7ac631af172de77bf94c037e07c02046ab 100644 --- a/spec/helpers/markup_helper_spec.rb +++ b/spec/helpers/markup_helper_spec.rb @@ -42,7 +42,7 @@ describe "override default project" do 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) } it 'links to the issue' do diff --git a/spec/helpers/notes_helper_spec.rb b/spec/helpers/notes_helper_spec.rb index 56f252ba27347ec474a3605e09e0f01f7b6379de..da1044cef3f7e734b12e9c7c5a3ee49d48d602d8 100644 --- a/spec/helpers/notes_helper_spec.rb +++ b/spec/helpers/notes_helper_spec.rb @@ -40,7 +40,7 @@ end describe '#discussion_path' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } context 'for a merge request discusion' do let(:merge_request) { create(:merge_request, source_project: project, target_project: project, importing: true) } diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 2105520367bfc7d59182283a3e4fb13781983709..f7fc19bdce6e0611039f5b76446920961cbfa143 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -46,7 +46,7 @@ end describe "readme_cache_key" do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } before do helper.instance_variable_set(:@project, project) @@ -64,7 +64,7 @@ end 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 expect(helper.project_list_cache_key(project)).to include(project.route.cache_key) @@ -260,7 +260,7 @@ end describe '#sanitized_import_error' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } before do allow(project).to receive(:repository_storage_path).and_return('/base/repo/path') diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb index ac64e54098f0ab97371fa067bc42682b961ed9fb..8c39bb78ccb7ac004da4c72edeb58481c533a225 100644 --- a/spec/helpers/search_helper_spec.rb +++ b/spec/helpers/search_helper_spec.rb @@ -18,7 +18,7 @@ def simple_sanitize(str) end it "returns parsed result" do - project = create :project + project = create :project, :repository project.repository.index_blobs diff --git a/spec/javascripts/fixtures/balsamiq.rb b/spec/javascripts/fixtures/balsamiq.rb index b5372821bf540e5901377e4eef1f77e6462d1584..234e246119a2ca6bd95617bf5fa88a3b3d4acc70 100644 --- a/spec/javascripts/fixtures/balsamiq.rb +++ b/spec/javascripts/fixtures/balsamiq.rb @@ -4,7 +4,7 @@ include JavaScriptFixturesHelpers 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 clean_frontend_fixtures('blob/balsamiq/') diff --git a/spec/javascripts/fixtures/dashboard.rb b/spec/javascripts/fixtures/dashboard.rb index e83db8daaf202ebeb81e3e7de03a603d58d63f30..b2114e65d278b749cd536098c981a06c7f132af4 100644 --- a/spec/javascripts/fixtures/dashboard.rb +++ b/spec/javascripts/fixtures/dashboard.rb @@ -5,7 +5,7 @@ let(:admin) { create(:admin) } 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 diff --git a/spec/javascripts/fixtures/merge_requests.rb b/spec/javascripts/fixtures/merge_requests.rb index 7e2f364ffa47f27e7d4e7d5f354cf0657cff858d..f9d8b5c569c9dacc6cd9f1664e5ce552b79c498b 100644 --- a/spec/javascripts/fixtures/merge_requests.rb +++ b/spec/javascripts/fixtures/merge_requests.rb @@ -5,7 +5,7 @@ let(:admin) { create(:admin) } 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(:merged_merge_request) { create(:merge_request, :merged, source_project: project, target_project: project) } let(:pipeline) do diff --git a/spec/javascripts/fixtures/merge_requests_diffs.rb b/spec/javascripts/fixtures/merge_requests_diffs.rb index ac5b06ace6d64c3a7e85208ef9879046a0b91cf6..4481a187f63dcc0e5e81cddf74daaa49318b592f 100644 --- a/spec/javascripts/fixtures/merge_requests_diffs.rb +++ b/spec/javascripts/fixtures/merge_requests_diffs.rb @@ -6,7 +6,7 @@ let(:admin) { create(:admin) } 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(:path) { "files/ruby/popen.rb" } let(:position) do diff --git a/spec/javascripts/fixtures/pdf.rb b/spec/javascripts/fixtures/pdf.rb index 6b2422a7986b4fe653d8c439c77b624c4a5c8157..ef9976b9fd3121f1330f38a76d864642e25f411a 100644 --- a/spec/javascripts/fixtures/pdf.rb +++ b/spec/javascripts/fixtures/pdf.rb @@ -4,7 +4,7 @@ include JavaScriptFixturesHelpers 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 clean_frontend_fixtures('blob/pdf/') diff --git a/spec/javascripts/fixtures/projects.rb b/spec/javascripts/fixtures/projects.rb index 27e83cd09060234190e0da812cf972aae13afe5b..e3b13e54022707c2409384f754033f08aaee11d7 100644 --- a/spec/javascripts/fixtures/projects.rb +++ b/spec/javascripts/fixtures/projects.rb @@ -5,7 +5,7 @@ let(:admin) { create(:admin) } 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 diff --git a/spec/javascripts/fixtures/raw.rb b/spec/javascripts/fixtures/raw.rb index 17533443d7632b3cbf195f667881632aa3046e76..25f5a3b0bb3a98f07c4a5853a8752fa21ab8976f 100644 --- a/spec/javascripts/fixtures/raw.rb +++ b/spec/javascripts/fixtures/raw.rb @@ -4,7 +4,7 @@ include JavaScriptFixturesHelpers 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 clean_frontend_fixtures('blob/notebook/') diff --git a/spec/lib/banzai/filter/reference_filter_spec.rb b/spec/lib/banzai/filter/reference_filter_spec.rb index b9ca68e89355143038ff0c9594b1811f83442e9b..81f244a4539e4fa5ad3ae1d5f72e4c27c19b6697 100644 --- a/spec/lib/banzai/filter/reference_filter_spec.rb +++ b/spec/lib/banzai/filter/reference_filter_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Banzai::Filter::ReferenceFilter do - let(:project) { build(:project) } + let(:project) { build_stubbed(:empty_project) } describe '#each_node' do it 'iterates over the nodes in a document' do diff --git a/spec/lib/container_registry/tag_spec.rb b/spec/lib/container_registry/tag_spec.rb index cb4ae3be525b8c95803b99fe7369a6a877441301..e76463b5e7cc354f09fbe86806e449e2e0c8a739 100644 --- a/spec/lib/container_registry/tag_spec.rb +++ b/spec/lib/container_registry/tag_spec.rb @@ -2,7 +2,7 @@ describe ContainerRegistry::Tag do 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 create(:container_repository, name: '', project: project) diff --git a/spec/lib/gitlab/authority_analyzer_spec.rb b/spec/lib/gitlab/authority_analyzer_spec.rb index bd637fef70a54c0442a22de1543ae042d8ae341c..b6670193b109433202bb3cc7a39592b7b49aea75 100644 --- a/spec/lib/gitlab/authority_analyzer_spec.rb +++ b/spec/lib/gitlab/authority_analyzer_spec.rb @@ -2,7 +2,7 @@ describe Gitlab::AuthorityAnalyzer do describe '#calculate' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:author) { create(:user) } let(:user_a) { create(:user) } let(:user_b) { create(:user) } diff --git a/spec/lib/gitlab/badge/coverage/report_spec.rb b/spec/lib/gitlab/badge/coverage/report_spec.rb index 1547bd3228c0c39c170032814077f180bbdf6967..da789bf370577099e3dc3a33cec0cc9b25df0f4d 100644 --- a/spec/lib/gitlab/badge/coverage/report_spec.rb +++ b/spec/lib/gitlab/badge/coverage/report_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Gitlab::Badge::Coverage::Report do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:job_name) { nil } let(:badge) do diff --git a/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb b/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb index 0daf41a7c8639f6abf46cf7c6150d50ff9e91e4d..1fab3b29424049b79a0ae2aa555f55023de75bb1 100644 --- a/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb +++ b/spec/lib/gitlab/cache/ci/project_pipeline_status_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' 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(:cache_key) { "projects/#{project.id}/pipeline_status" } @@ -18,7 +18,7 @@ let(:sha) { '424d1b73bc0d3cb726eb7dc4ce17a4d48552f8c6' } let(:ref) { 'master' } 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 it 'preloads pipeline_status on projects' do diff --git a/spec/lib/gitlab/checks/change_access_spec.rb b/spec/lib/gitlab/checks/change_access_spec.rb index f41da2e9fc8311cabd3631180cd0f29b41473214..2c94b54c6d5418245518ed63bdfbe02a356a2629 100644 --- a/spec/lib/gitlab/checks/change_access_spec.rb +++ b/spec/lib/gitlab/checks/change_access_spec.rb @@ -173,7 +173,7 @@ it { is_expected.to be_truthy } end - let(:project) { create(:project, :public, push_rule: push_rule) } + let(:project) { create(:project, :public, :repository, push_rule: push_rule) } before do allow(project.repository).to receive(:new_commits).and_return( diff --git a/spec/lib/gitlab/cycle_analytics/base_event_fetcher_spec.rb b/spec/lib/gitlab/cycle_analytics/base_event_fetcher_spec.rb index d8757c601ab854864c165909ec88ff7a51209807..854aaa34c731c7e25629fe088fcf24b433993146 100644 --- a/spec/lib/gitlab/cycle_analytics/base_event_fetcher_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/base_event_fetcher_spec.rb @@ -2,7 +2,7 @@ describe Gitlab::CycleAnalytics::BaseEventFetcher do let(:max_events) { 2 } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:user) { create(:user, :admin) } let(:start_time_attrs) { Issue.arel_table[:created_at] } let(:end_time_attrs) { [Issue::Metrics.arel_table[:first_associated_with_milestone_at]] } diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb index a1b3fe8509e56d1f2e7643434db980604783b495..28ea7d4c30307fe501234128558fe035091f9459 100644 --- a/spec/lib/gitlab/cycle_analytics/events_spec.rb +++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'cycle analytics events' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:from_date) { 10.days.ago } let(:user) { create(:user, :admin) } let!(:context) { create(:issue, project: project, created_at: 2.days.ago) } diff --git a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base_spec.rb b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base_spec.rb index df7d1b5d27a082d5080459b556ba0e8d68a7f28f..254ce06381e099a0333a033c0cb2a442550004c8 100644 --- a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base_spec.rb +++ b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_base_spec.rb @@ -94,7 +94,7 @@ def migration_project(project) end 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)) @@ -120,7 +120,7 @@ def migration_project(project) context "the-path namespace -> subgroup -> the-path0 project" do it "updates the route of the project correctly" do 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)) @@ -165,7 +165,7 @@ def migration_project(project) it 'renames all the routes for the namespace' do 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') subject.perform_rename(migration_namespace(namespace), 'the-path', 'renamed') diff --git a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb index 803e923b4a58e7e756b5124d6d1b21c25f54e3f8..95695ca8c165bce2af43a3d4d4d4fd06de1a4714 100644 --- a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb +++ b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces_spec.rb @@ -94,7 +94,7 @@ def migration_namespace(namespace) describe '#move_repositories' do let(:namespace) { create(:group, name: 'hello-group') } 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') subject.move_repositories(namespace, 'hello-group', 'bye-group') @@ -104,7 +104,7 @@ def migration_namespace(namespace) it 'moves a namespace in a subdirectory correctly' do 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') @@ -115,7 +115,7 @@ def migration_namespace(namespace) it 'moves a parent namespace with subdirectories' do 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') subject.move_repositories(child_namespace, 'hello-group', 'renamed-group') @@ -166,7 +166,7 @@ def migration_namespace(namespace) describe '#rename_namespace_dependencies' 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") subject.rename_namespace_dependencies(namespace, 'the-path', 'the-path0') @@ -243,7 +243,7 @@ def migration_namespace(namespace) describe '#revert_renames', redis: true 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) expect(subject).to receive(:perform_rename) @@ -261,7 +261,7 @@ def migration_namespace(namespace) end 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 subject.rename_namespace(namespace) diff --git a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb index 0e240a5ccf161a654c75dc0dfcbcfef632a130d8..19e23a32bdae3c6f94cb0f98d46dc79fe346981f 100644 --- a/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb +++ b/spec/lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects_spec.rb @@ -104,7 +104,7 @@ describe '#move_repository' do 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 expected_path = File.join(TestEnv.repos_path, 'known-parent', 'new-repo.git') diff --git a/spec/lib/gitlab/diff/parser_spec.rb b/spec/lib/gitlab/diff/parser_spec.rb index c71568e2a65f89b3ae79e1bff181f9afca7b0a9b..8af49ed50ff0fa4950cb5855d15a1fc3cbd6a95d 100644 --- a/spec/lib/gitlab/diff/parser_spec.rb +++ b/spec/lib/gitlab/diff/parser_spec.rb @@ -3,7 +3,7 @@ describe Gitlab::Diff::Parser do include RepoHelpers - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:commit) { project.commit(sample_commit.id) } let(:diff) { commit.raw_diffs.first } let(:parser) { described_class.new } diff --git a/spec/lib/gitlab/elastic/indexer_spec.rb b/spec/lib/gitlab/elastic/indexer_spec.rb index f81be3a0329cbbea58d9dfea068c2d0f676993cf..bea91e1925e7c7e3d7190af088a49800e76be300 100644 --- a/spec/lib/gitlab/elastic/indexer_spec.rb +++ b/spec/lib/gitlab/elastic/indexer_spec.rb @@ -8,7 +8,7 @@ stub_application_setting(elasticsearch_url: ['http://localhost:9200']) end - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:from_sha) { Gitlab::Git::BLANK_SHA } let(:to_sha) { project.commit.try(:sha) } let(:indexer) { described_class.new(project) } @@ -40,7 +40,7 @@ end context 'test project' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } it 'runs the indexing command' do expect_popen.with( diff --git a/spec/lib/gitlab/elastic/project_search_results_spec.rb b/spec/lib/gitlab/elastic/project_search_results_spec.rb index a578286b39cc1da987b58034f54d010eba823e71..bb897f77c1a8296fb4951c152b0015887d7cc0c9 100644 --- a/spec/lib/gitlab/elastic/project_search_results_spec.rb +++ b/spec/lib/gitlab/elastic/project_search_results_spec.rb @@ -2,7 +2,7 @@ describe Gitlab::Elastic::ProjectSearchResults do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:query) { 'hello world' } before do @@ -34,8 +34,8 @@ describe "search" do it "returns correct amounts" do - project = create :project, :public - project1 = create :project, :public + project = create :project, :public, :repository + project1 = create :project, :public, :repository project.repository.index_blobs project.repository.index_commits @@ -81,7 +81,7 @@ end 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(:result) { described_class.new(user, 'initial', project.id, 'test') } diff --git a/spec/lib/gitlab/elastic/search_results_spec.rb b/spec/lib/gitlab/elastic/search_results_spec.rb index 3b8925f670385357f045b4a89eaff76781a8cf53..7613396ada2074f2db70ae7a3cd8318f6f7358f5 100644 --- a/spec/lib/gitlab/elastic/search_results_spec.rb +++ b/spec/lib/gitlab/elastic/search_results_spec.rb @@ -12,8 +12,8 @@ end let(:user) { create(:user) } - let(:project_1) { create(:project) } - let(:project_2) { create(:project) } + let(:project_1) { create(:project, :repository) } + let(:project_2) { create(:project, :repository) } let(:limit_project_ids) { [project_1.id] } describe 'issues' do @@ -334,7 +334,7 @@ describe 'project scoping' do it "returns items for project" do - project = create :project, name: "term" + project = create :project, :repository, name: "term" # Create issue create :issue, title: 'bla-bla term', project: project @@ -383,7 +383,7 @@ end it 'finds blobs from public projects only' do - project_2 = create :project, :private + project_2 = create :project, :repository, :private project_2.repository.index_blobs Gitlab::Elastic::Helper.refresh_index @@ -468,7 +468,7 @@ def search_for(term) end 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.index_blobs Gitlab::Elastic::Helper.refresh_index @@ -486,7 +486,7 @@ def search_for(term) end 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 let(:limit_project_ids) { [project_1.id] } @@ -502,7 +502,7 @@ def search_for(term) end 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 let(:limit_project_ids) { [project_1.id] } @@ -534,7 +534,7 @@ def search_for(term) end it 'finds commits from public projects only' do - project_2 = create :project, :private + project_2 = create :project, :private, :repository project_2.repository.index_commits Gitlab::Elastic::Helper.refresh_index @@ -553,10 +553,10 @@ def search_for(term) end describe 'Visibility levels' do - let(:internal_project) { create(:project, :internal, description: "Internal project") } - let(:private_project1) { create(:project, :private, description: "Private project") } - let(:private_project2) { create(:project, :private, description: "Private project where I'm a member") } - let(:public_project) { create(:project, :public, description: "Public project") } + let(:internal_project) { create(:project, :internal, :repository, description: "Internal project") } + let(:private_project1) { create(:project, :private, :repository, description: "Private project") } + let(:private_project2) { create(:project, :private, :repository, description: "Private project where I'm a member") } + let(:public_project) { create(:project, :public, :repository, description: "Public project") } let(:limit_project_ids) { [private_project2.id] } before do diff --git a/spec/lib/gitlab/email/attachment_uploader_spec.rb b/spec/lib/gitlab/email/attachment_uploader_spec.rb index f61dbc67ad1803eb513dcef3936c1c19655f6083..89258d2eca72e486e3236b9db54c7456b73cb2ea 100644 --- a/spec/lib/gitlab/email/attachment_uploader_spec.rb +++ b/spec/lib/gitlab/email/attachment_uploader_spec.rb @@ -2,7 +2,7 @@ describe Gitlab::Email::AttachmentUploader do describe "#execute" do - let(:project) { build(:project) } + let(:project) { build(:empty_project) } let(:message_raw) { fixture_file("emails/attachment.eml") } let(:message) { Mail::Message.new(message_raw) } diff --git a/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb b/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb index bd36d1d309d8674be2db66ccfe2a3566c6858518..6d0e715e8898c85054498a63694557e228dfca4a 100644 --- a/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb @@ -69,7 +69,7 @@ end 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 expect { receiver.execute }.to raise_error(Gitlab::Email::ProjectNotFound) diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index 9f68e87ccb39705713e6c48802728bce77d4698f..eab9685827bce10a47b0d8181f0f89d144ec382f 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -928,7 +928,7 @@ def self.run_group_permission_checks(permissions_matrix) end 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 project.team << [user, :master] diff --git a/spec/lib/gitlab/github_import/importer_spec.rb b/spec/lib/gitlab/github_import/importer_spec.rb index d00a2deaf7bc033b28b1dda25a6f3e8a43fef7e0..d570f34985bb29d683ff6ab07aea7770d46b9a16 100644 --- a/spec/lib/gitlab/github_import/importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer_spec.rb @@ -207,7 +207,7 @@ 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(:credentials) { { user: 'joe' } } diff --git a/spec/lib/gitlab/github_import/wiki_formatter_spec.rb b/spec/lib/gitlab/github_import/wiki_formatter_spec.rb index fcd90fab547134582e5d09622dcfa03223c7c8d4..119bf2b5662c01337a4880876416b836176340fb 100644 --- a/spec/lib/gitlab/github_import/wiki_formatter_spec.rb +++ b/spec/lib/gitlab/github_import/wiki_formatter_spec.rb @@ -2,7 +2,7 @@ describe Gitlab::GithubImport::WikiFormatter do let(:project) do - create(:project, + create(:empty_project, namespace: create(:namespace, path: 'gitlabhq'), import_url: 'https://xxx@github.com/gitlabhq/sample.gitlabhq.git') end diff --git a/spec/lib/gitlab/gl_repository_spec.rb b/spec/lib/gitlab/gl_repository_spec.rb index ac3558ab386858771ac8be60b9cfc51f17c3e469..4e09020471ba4b285901e80c9bb85812af2c6d4b 100644 --- a/spec/lib/gitlab/gl_repository_spec.rb +++ b/spec/lib/gitlab/gl_repository_spec.rb @@ -2,7 +2,7 @@ describe ::Gitlab::GlRepository do describe '.parse' do - set(:project) { create(:project) } + set(:project) { create(:project, :repository) } it 'parses a project gl_repository' do expect(described_class.parse("project-#{project.id}")).to eq([project, false]) diff --git a/spec/lib/gitlab/import_export/fork_spec.rb b/spec/lib/gitlab/import_export/fork_spec.rb index 30f2a775fccac21161d1337f10da5dc925865869..230cc2d30067632a2cfb2dd15fe22ed39cc6217d 100644 --- a/spec/lib/gitlab/import_export/fork_spec.rb +++ b/spec/lib/gitlab/import_export/fork_spec.rb @@ -2,11 +2,11 @@ describe 'forked project import' do 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(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" } 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(: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) } diff --git a/spec/lib/gitlab/import_export/merge_request_parser_spec.rb b/spec/lib/gitlab/import_export/merge_request_parser_spec.rb index 349be4596b6461025f47e4d10d8a2471652f0904..4d87f27ce05d03c3eab52284745ff9c99e7fa4a6 100644 --- a/spec/lib/gitlab/import_export/merge_request_parser_spec.rb +++ b/spec/lib/gitlab/import_export/merge_request_parser_spec.rb @@ -2,8 +2,8 @@ describe Gitlab::ImportExport::MergeRequestParser do let(:user) { create(:user) } - let!(:project) { create(:project, :test_repo, name: 'test-repo-restorer', path: 'test-repo-restorer') } - let(:forked_from_project) { create(:project) } + let!(:project) { create(:project, :repository, name: 'test-repo-restorer', path: 'test-repo-restorer') } + let(:forked_from_project) { create(:project, :repository) } let(:fork_link) { create(:forked_project_link, forked_from_project: project) } let!(:merge_request) do diff --git a/spec/lib/gitlab/import_export/repo_restorer_spec.rb b/spec/lib/gitlab/import_export/repo_restorer_spec.rb index ba8370175d1f44c6158b6c43a064dcac13064915..d57833c3fec3bd2d0fc462aede577cf51ac05aa1 100644 --- a/spec/lib/gitlab/import_export/repo_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/repo_restorer_spec.rb @@ -3,7 +3,7 @@ describe Gitlab::ImportExport::RepoRestorer do describe 'bundle a project Git repo' do 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(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" } let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) } diff --git a/spec/lib/gitlab/issuable_sorter_spec.rb b/spec/lib/gitlab/issuable_sorter_spec.rb index aeb32ef96d6f87e4ec0ecc07892a604d3cc958b4..c4138c063c848aa68c3d5a6d220ca4518ea88ebc 100644 --- a/spec/lib/gitlab/issuable_sorter_spec.rb +++ b/spec/lib/gitlab/issuable_sorter_spec.rb @@ -1,25 +1,25 @@ require 'spec_helper' describe Gitlab::IssuableSorter do - let(:namespace1) { build(:namespace, id: 1) } - let(:project1) { build(:project, id: 1, namespace: namespace1) } + let(:namespace1) { build_stubbed(:namespace, id: 1) } + let(:project1) { build_stubbed(:empty_project, id: 1, namespace: namespace1) } - let(:project2) { build(:project, id: 2, path: "a", namespace: project1.namespace) } - let(:project3) { build(:project, id: 3, path: "b", namespace: project1.namespace) } + let(:project2) { build_stubbed(:empty_project, id: 2, path: "a", 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(:namespace3) { build(:namespace, id: 3, path: "b") } - let(:project4) { build(:project, id: 4, path: "a", namespace: namespace2) } - let(:project5) { build(:project, id: 5, path: "b", namespace: namespace2) } - let(:project6) { build(:project, id: 6, path: "a", namespace: namespace3) } + let(:namespace2) { build_stubbed(:namespace, id: 2, path: "a") } + let(:namespace3) { build_stubbed(:namespace, id: 3, path: "b") } + let(:project4) { build_stubbed(:empty_project, id: 4, path: "a", namespace: namespace2) } + let(:project5) { build_stubbed(:empty_project, id: 5, path: "b", namespace: namespace2) } + let(:project6) { build_stubbed(:empty_project, id: 6, path: "a", namespace: namespace3) } let(:unsorted) { [sorted[2], sorted[3], sorted[0], sorted[1]] } let(:sorted) do - [build(:issue, iid: 1, project: project1), - build(:issue, iid: 2, project: project1), - build(:issue, iid: 10, project: project1), - build(:issue, iid: 20, project: project1)] + [build_stubbed(:issue, iid: 1, project: project1), + build_stubbed(:issue, iid: 2, project: project1), + build_stubbed(:issue, iid: 10, project: project1), + build_stubbed(:issue, iid: 20, project: project1)] end it 'sorts references by a given key' do @@ -41,14 +41,14 @@ context 'for references from multiple projects and namespaces' do let(:sorted) do - [build(:issue, iid: 1, project: project1), - build(:issue, iid: 2, project: project1), - build(:issue, iid: 10, project: project1), - build(:issue, iid: 1, project: project2), - build(:issue, iid: 1, project: project3), - build(:issue, iid: 1, project: project4), - build(:issue, iid: 1, project: project5), - build(:issue, iid: 1, project: project6)] + [build_stubbed(:issue, iid: 1, project: project1), + build_stubbed(:issue, iid: 2, project: project1), + build_stubbed(:issue, iid: 10, project: project1), + build_stubbed(:issue, iid: 1, project: project2), + build_stubbed(:issue, iid: 1, project: project3), + build_stubbed(:issue, iid: 1, project: project4), + build_stubbed(:issue, iid: 1, project: project5), + build_stubbed(:issue, iid: 1, project: project6)] end let(:unsorted) do [sorted[3], sorted[1], sorted[4], sorted[2], diff --git a/spec/lib/gitlab/middleware/go_spec.rb b/spec/lib/gitlab/middleware/go_spec.rb index 6af1564da190a1127a9621cd159f9e4927f72a68..de4c8b68ffa8e10910c3eaef58afaec18d87d151 100644 --- a/spec/lib/gitlab/middleware/go_spec.rb +++ b/spec/lib/gitlab/middleware/go_spec.rb @@ -18,7 +18,7 @@ let(:current_user) { nil } context 'with simple 2-segment project path' do - let!(:project) { create(:project, :private) } + let!(:project) { create(:empty_project, :private) } context 'with subpackages' do let(:path) { "#{project.full_path}/subpackage" } @@ -39,7 +39,7 @@ context 'with a nested project path' do 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 context 'when the project is public' do diff --git a/spec/lib/gitlab/project_search_results_spec.rb b/spec/lib/gitlab/project_search_results_spec.rb index b46bfd6b7c3582e46c72b6c507d71fbfe30958f3..792e4f49418f0ebdc877562e63ce38192e5d257e 100644 --- a/spec/lib/gitlab/project_search_results_spec.rb +++ b/spec/lib/gitlab/project_search_results_spec.rb @@ -100,14 +100,14 @@ end describe 'wiki search' do - let(:project) { create(:project, :public) } + let(:project) { create(:empty_project, :public) } let(:wiki) { build(:project_wiki, project: project) } let!(:wiki_page) { wiki.create_page('Title', 'Content') } subject(:results) { described_class.new(user, project, 'Content').objects('wiki_blobs') } 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 project.add_reporter(user) @@ -121,7 +121,7 @@ end 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 project.add_guest(user) diff --git a/spec/lib/gitlab/repo_path_spec.rb b/spec/lib/gitlab/repo_path_spec.rb index efea4f429bfa358924d11430d5e4dda186b8cf24..6336f4a7125ef2effd6423cbc7dd62bc12039e87 100644 --- a/spec/lib/gitlab/repo_path_spec.rb +++ b/spec/lib/gitlab/repo_path_spec.rb @@ -2,7 +2,7 @@ describe ::Gitlab::RepoPath do describe '.parse' do - set(:project) { create(:project) } + set(:project) { create(:project, :repository) } context 'a repository storage path' do it 'parses a full repository path' do diff --git a/spec/lib/gitlab/user_access_spec.rb b/spec/lib/gitlab/user_access_spec.rb index 5ebaf6c1507c1f8b75839a054e94069bd36b996f..cd97416bcc983e617a93c670eaec16f5327a09b1 100644 --- a/spec/lib/gitlab/user_access_spec.rb +++ b/spec/lib/gitlab/user_access_spec.rb @@ -2,7 +2,7 @@ describe Gitlab::UserAccess do let(:access) { described_class.new(user, project: project) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:user) { create(:user) } describe '#can_push_to_branch?' do diff --git a/spec/migrations/rename_system_namespaces_spec.rb b/spec/migrations/rename_system_namespaces_spec.rb index 626a600583838dfa0e0fc6287ce79bdc5b5e3adf..747694cbe33baeb2666d3c383e005902237e6e73 100644 --- a/spec/migrations/rename_system_namespaces_spec.rb +++ b/spec/migrations/rename_system_namespaces_spec.rb @@ -58,7 +58,7 @@ def save_invalid_routable(routable) end 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) migration.up @@ -68,7 +68,7 @@ def save_invalid_routable(routable) it "doesn't touch routes of namespaces that look like system" do namespace = create(:group, path: 'systemlookalike') - project = create(:project, namespace: namespace, path: 'the-project') + project = create(:project, :repository, namespace: namespace, path: 'the-project') migration.up @@ -77,7 +77,7 @@ def save_invalid_routable(routable) end 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) TestEnv.copy_repo(project, bare_repo: TestEnv.factory_repo_path_bare, @@ -105,7 +105,7 @@ def save_invalid_routable(routable) describe "clears the markdown cache for projects in the system namespace" do let!(:project) do - project = build(:project, namespace: system_namespace) + project = build(:project, :repository, namespace: system_namespace) save_invalid_routable(project) project end @@ -161,7 +161,7 @@ def save_invalid_routable(routable) it "updates the route of the project correctly" do subgroup = build(:group, path: "subgroup", parent: system_namespace) save_invalid_routable(subgroup) - project = build(:project, path: "system0", namespace: subgroup) + project = build(:project, :repository, path: "system0", namespace: subgroup) save_invalid_routable(project) migration.up @@ -174,7 +174,7 @@ def save_invalid_routable(routable) describe "#move_repositories" do let(:namespace) { create(:group, name: "hello-group") } 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") migration.move_repositories(namespace, "hello-group", "bye-group") @@ -184,7 +184,7 @@ def save_invalid_routable(routable) it "moves a namespace in a subdirectory correctly" do 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") @@ -195,7 +195,7 @@ def save_invalid_routable(routable) it "moves a parent namespace with subdirectories" do 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") migration.move_repositories(child_namespace, "hello-group", "renamed-group") diff --git a/spec/models/blob_viewer/composer_json_spec.rb b/spec/models/blob_viewer/composer_json_spec.rb index 82f6f7e5046717fc9751e75098a64876caf48f6a..35e7e1805d4d9e812b35937b40c5f58ded05e1c4 100644 --- a/spec/models/blob_viewer/composer_json_spec.rb +++ b/spec/models/blob_viewer/composer_json_spec.rb @@ -3,7 +3,7 @@ describe BlobViewer::ComposerJson do include FakeBlobHelpers - let(:project) { build(:project) } + let(:project) { build_stubbed(:empty_project) } let(:data) do <<-SPEC.strip_heredoc { diff --git a/spec/models/blob_viewer/gemspec_spec.rb b/spec/models/blob_viewer/gemspec_spec.rb index 14cc5f3c0fd273a9bc539bc3185d56831872e0ab..5406ff552f8d02f52c62e7b6c9179d70e6155080 100644 --- a/spec/models/blob_viewer/gemspec_spec.rb +++ b/spec/models/blob_viewer/gemspec_spec.rb @@ -3,7 +3,7 @@ describe BlobViewer::Gemspec do include FakeBlobHelpers - let(:project) { build(:project) } + let(:project) { build_stubbed(:empty_project) } let(:data) do <<-SPEC.strip_heredoc Gem::Specification.new do |s| diff --git a/spec/models/blob_viewer/gitlab_ci_yml_spec.rb b/spec/models/blob_viewer/gitlab_ci_yml_spec.rb index 7a4f9866375f5c3923d16592f69da8bf6af60685..344fcdeb9b6b7cc3eb36874bb33bafc21e2f1652 100644 --- a/spec/models/blob_viewer/gitlab_ci_yml_spec.rb +++ b/spec/models/blob_viewer/gitlab_ci_yml_spec.rb @@ -3,7 +3,7 @@ describe BlobViewer::GitlabCiYml do 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(:blob) { fake_blob(path: '.gitlab-ci.yml', data: data) } subject { described_class.new(blob) } diff --git a/spec/models/blob_viewer/package_json_spec.rb b/spec/models/blob_viewer/package_json_spec.rb index 96fb1b08c99c2f824e0732d9737f4f15a8ea6d29..976c2ed3639fab80c749eb0ac27080d8cc524d9b 100644 --- a/spec/models/blob_viewer/package_json_spec.rb +++ b/spec/models/blob_viewer/package_json_spec.rb @@ -3,7 +3,7 @@ describe BlobViewer::PackageJson do include FakeBlobHelpers - let(:project) { build(:project) } + let(:project) { build_stubbed(:empty_project) } let(:data) do <<-SPEC.strip_heredoc { diff --git a/spec/models/blob_viewer/podspec_json_spec.rb b/spec/models/blob_viewer/podspec_json_spec.rb index f510077a87b870ae4e51b032bd64359ac56dc74b..b98360ea7b74fdbc35c09660ffe1c0df511c67ed 100644 --- a/spec/models/blob_viewer/podspec_json_spec.rb +++ b/spec/models/blob_viewer/podspec_json_spec.rb @@ -3,7 +3,7 @@ describe BlobViewer::PodspecJson do include FakeBlobHelpers - let(:project) { build(:project) } + let(:project) { build_stubbed(:empty_project) } let(:data) do <<-SPEC.strip_heredoc { diff --git a/spec/models/blob_viewer/podspec_spec.rb b/spec/models/blob_viewer/podspec_spec.rb index 7c38083550cc38dbc6d8cd895044cd87ce03f4a1..ad2bbe034ea433b30a2b35e0cac8109f2f8b6410 100644 --- a/spec/models/blob_viewer/podspec_spec.rb +++ b/spec/models/blob_viewer/podspec_spec.rb @@ -3,7 +3,7 @@ describe BlobViewer::Podspec do include FakeBlobHelpers - let(:project) { build(:project) } + let(:project) { build_stubbed(:empty_project) } let(:data) do <<-SPEC.strip_heredoc Pod::Spec.new do |spec| diff --git a/spec/models/blob_viewer/route_map_spec.rb b/spec/models/blob_viewer/route_map_spec.rb index 115731b4970178ed1615ca15f8df17ec83e3015f..12b6519a344e729acb417d0134d85d20a8274ad7 100644 --- a/spec/models/blob_viewer/route_map_spec.rb +++ b/spec/models/blob_viewer/route_map_spec.rb @@ -3,7 +3,7 @@ describe BlobViewer::RouteMap do include FakeBlobHelpers - let(:project) { build(:project) } + let(:project) { build_stubbed(:empty_project) } let(:data) do <<-MAP.strip_heredoc # Team data diff --git a/spec/models/concerns/elastic/merge_request_spec.rb b/spec/models/concerns/elastic/merge_request_spec.rb index f28c43b76974da327339346c869b1737c218c340..c22a372183dd35bd8bd3b5392f42b33a558376d0 100644 --- a/spec/models/concerns/elastic/merge_request_spec.rb +++ b/spec/models/concerns/elastic/merge_request_spec.rb @@ -12,7 +12,7 @@ end it "searches merge requests" do - project = create :project + project = create :project, :repository Sidekiq::Testing.inline! do create :merge_request, title: 'bla-bla term1', source_project: project diff --git a/spec/models/concerns/elastic/note_spec.rb b/spec/models/concerns/elastic/note_spec.rb index d6dbd66721698925b5912cd4cd39d1bbc63807c9..e46d6fe809aa9a2f00e80e84bf8ea41f46e1d90f 100644 --- a/spec/models/concerns/elastic/note_spec.rb +++ b/spec/models/concerns/elastic/note_spec.rb @@ -65,7 +65,7 @@ end it "does not create ElasticIndexerWorker job for system messages" do - project = create :project + project = create :project, :repository issue = create :issue, project: project # Only issue should be updated diff --git a/spec/models/concerns/elastic/repository_spec.rb b/spec/models/concerns/elastic/repository_spec.rb index 996676b044998a467df50d673b331ebfe87e8c09..1728d5c6746687c7191a7e2a2d0f03d26c0f935c 100644 --- a/spec/models/concerns/elastic/repository_spec.rb +++ b/spec/models/concerns/elastic/repository_spec.rb @@ -12,7 +12,7 @@ end it "searches blobs and commits" do - project = create :project + project = create :project, :repository Sidekiq::Testing.inline! do project.repository.index_blobs @@ -28,8 +28,8 @@ describe "class method find_commits_by_message_with_elastic" do it "returns commits" do - project = create :project - project1 = create :project + project = create :project, :repository + project1 = create :project, :repository project.repository.index_commits project1.repository.index_commits @@ -44,7 +44,7 @@ describe "find_commits_by_message_with_elastic" do it "returns commits" do - project = create :project + project = create :project, :repository project.repository.index_commits diff --git a/spec/models/concerns/elastic/snippet_spec.rb b/spec/models/concerns/elastic/snippet_spec.rb index c26c19e2c1b0acb6e1d3f3fcaedb096ff32d0798..663d4ca8f1194a0a6b656eb225b6d2eae4351404 100644 --- a/spec/models/concerns/elastic/snippet_spec.rb +++ b/spec/models/concerns/elastic/snippet_spec.rb @@ -13,7 +13,7 @@ context 'searching snippets by code' do let!(:author) { create(:user) } - let!(:project) { create(:project) } + let!(:project) { create(:empty_project) } let!(:public_snippet) { create(:snippet, :public, content: 'password: XXX') } let!(:internal_snippet) { create(:snippet, :internal, content: 'password: XXX') } diff --git a/spec/models/concerns/participable_spec.rb b/spec/models/concerns/participable_spec.rb index 431f1482615d65e03d8b5464848f66ad82cc8ab4..6c4b5a9e9d61cca478baa63d165c09f6b3924dd0 100644 --- a/spec/models/concerns/participable_spec.rb +++ b/spec/models/concerns/participable_spec.rb @@ -24,7 +24,7 @@ user1 = build(:user) user2 = build(:user) user3 = build(:user) - project = build(:project, :public) + project = build(:empty_project, :public) instance = model.new expect(instance).to receive(:foo).and_return(user2) @@ -57,7 +57,7 @@ other = other_model.new user1 = build(:user) user2 = build(:user) - project = build(:project, :public) + project = build(:empty_project, :public) expect(instance).to receive(:foo).and_return(other) expect(other).to receive(:bar).and_return(user2) @@ -69,7 +69,7 @@ context 'when using a Proc as an attribute' do it 'calls the supplied Proc' do user1 = build(:user) - project = build(:project, :public) + project = build(:empty_project, :public) user_arg = nil ext_arg = nil diff --git a/spec/models/concerns/resolvable_note_spec.rb b/spec/models/concerns/resolvable_note_spec.rb index 53eaa6f846118961143380be52301c9458172d1f..d00faa4f8be7f5642a2cc11c0def103e7210618c 100644 --- a/spec/models/concerns/resolvable_note_spec.rb +++ b/spec/models/concerns/resolvable_note_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Note, ResolvableNote do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project) } subject { create(:discussion_note_on_merge_request, noteable: merge_request, project: project) } diff --git a/spec/models/concerns/routable_spec.rb b/spec/models/concerns/routable_spec.rb index adba34e90bbfe4bd5c4609be2c22596dc1c6afe5..88d15e9735aaa429809c8d41473c5e4d4c32c80d 100644 --- a/spec/models/concerns/routable_spec.rb +++ b/spec/models/concerns/routable_spec.rb @@ -37,7 +37,7 @@ it 'ensure route path uniqueness across different objects' do create(:group, parent: group, path: 'xyz') - duplicate = build(:project, namespace: group, path: 'xyz') + duplicate = build(:empty_project, namespace: group, path: 'xyz') expect { duplicate.save! }.to raise_error(ActiveRecord::RecordInvalid, 'Validation failed: Route path has already been taken, Route is invalid') end diff --git a/spec/models/container_repository_spec.rb b/spec/models/container_repository_spec.rb index eff41d85972d4d7775abb3507e0efa3469a8b92c..bae88cb1d24bc72dcd5eed25b5a25792ea102463 100644 --- a/spec/models/container_repository_spec.rb +++ b/spec/models/container_repository_spec.rb @@ -2,7 +2,7 @@ describe ContainerRepository do 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 create(:container_repository, name: 'my_image', project: project) @@ -41,7 +41,7 @@ end context 'when path contains uppercase letters' do - let(:project) { create(:project, path: 'MY_PROJECT', group: group) } + let(:project) { create(:project, :repository, path: 'MY_PROJECT', group: group) } it 'returns a full path without capital letters' do expect(repository.path).to eq('group/my_project/my_image') diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 6447095078b7bac7ec61c45bfe0f7817e610247a..c5708e70ef9ddec0688d5d89e366d43f4660d216 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -91,7 +91,7 @@ end describe '#additional_metrics' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:deployment) { create(:deployment, project: project) } subject { deployment.additional_metrics } diff --git a/spec/models/diff_discussion_spec.rb b/spec/models/diff_discussion_spec.rb index 2704698f6c9813f0f6fce4ef21708e7a15c105c8..fa02434b0fdb0e917f8971d2953ff14d998bb6dc 100644 --- a/spec/models/diff_discussion_spec.rb +++ b/spec/models/diff_discussion_spec.rb @@ -5,7 +5,7 @@ subject { described_class.new([diff_note]) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let(:diff_note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) } diff --git a/spec/models/ee/ci/build_spec.rb b/spec/models/ee/ci/build_spec.rb index 54d22653ae184e05dc007b68a5d44c807ffcc6f1..3ec2d52450373d0a48c8b871915ec39e28b3bc42 100644 --- a/spec/models/ee/ci/build_spec.rb +++ b/spec/models/ee/ci/build_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Ci::Build do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:pipeline) do create(:ci_pipeline, project: project, diff --git a/spec/models/ee/merge_request_spec.rb b/spec/models/ee/merge_request_spec.rb index 762d1b03c6d824eb06902d681f55fa9b93ec57f6..c189ab42923c30ebd379f9bbfa83a554b0787174 100644 --- a/spec/models/ee/merge_request_spec.rb +++ b/spec/models/ee/merge_request_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe MergeRequest do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } subject(:merge_request) { create(:merge_request, source_project: project, target_project: project) } @@ -19,7 +19,7 @@ end context 'project allows rebase' do - let(:project) { create(:project, merge_requests_rebase_enabled: true) } + let(:project) { create(:project, :repository, merge_requests_rebase_enabled: true) } it 'returns false when the project feature is unavailable' do expect(merge_request.target_project).to receive(:feature_available?).with(:merge_request_rebase).at_least(:once).and_return(false) diff --git a/spec/models/ee/project_spec.rb b/spec/models/ee/project_spec.rb index 48208329fa566e7f36c5c3e4968970933a093297..5731d71ecbab86959f2a0c842dcd5e32bfcc384f 100644 --- a/spec/models/ee/project_spec.rb +++ b/spec/models/ee/project_spec.rb @@ -17,7 +17,7 @@ end describe '#push_rule' do - let(:project) { create(:project, push_rule: create(:push_rule)) } + let(:project) { create(:empty_project, push_rule: create(:push_rule)) } subject(:push_rule) { project.push_rule(true) } @@ -63,7 +63,7 @@ describe '#execute_hooks' do it "triggers project and group hooks" do group = create :group, name: 'gitlab' - project = create(:project, name: 'gitlabhq', namespace: group) + project = create(:empty_project, name: 'gitlabhq', namespace: group) project_hook = create(:project_hook, push_events: true, project: project) group_hook = create(:group_hook, push_events: true, group: group) @@ -78,7 +78,7 @@ end describe '#allowed_to_share_with_group?' do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } it "returns true" do expect(project.allowed_to_share_with_group?).to be_truthy @@ -92,7 +92,7 @@ describe '#feature_available?' do let(:namespace) { build_stubbed(:namespace) } - let(:project) { build_stubbed(:project, namespace: namespace) } + let(:project) { build_stubbed(:empty_project, namespace: namespace) } let(:user) { build_stubbed(:user) } subject { project.feature_available?(feature, user) } @@ -647,7 +647,7 @@ ].each do |spec| context spec.inspect do let(:spec) { spec } - let(:project) { build(:project, approvals_before_merge: spec[:database]) } + let(:project) { build(:empty_project, approvals_before_merge: spec[:database]) } subject { project.approvals_before_merge } @@ -669,7 +669,7 @@ ].each do |spec| context spec.inspect do let(:spec) { spec } - let(:project) { build(:project, reset_approvals_on_push: spec[:database]) } + let(:project) { build(:empty_project, reset_approvals_on_push: spec[:database]) } subject { project.reset_approvals_on_push? } @@ -691,7 +691,7 @@ ].each do |spec| context spec.inspect do let(:spec) { spec } - let(:project) { build(:project, approvals_before_merge: spec[:database]) } + let(:project) { build(:empty_project, approvals_before_merge: spec[:database]) } subject { project.approvals_before_merge } @@ -785,7 +785,7 @@ describe '#disabled_services' do let(:namespace) { create(:group, :private) } - let(:project) { create(:project, :private, namespace: namespace) } + let(:project) { create(:empty_project, :private, namespace: namespace) } let(:disabled_services) { %w(jenkins jenkins_deprecated) } context 'without a license key' do diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index 82085e28c70b3da2f319b6c1880a5c0aa1e73548..982dac4e35b697375a7ad6091333e4516c36e5a6 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -21,7 +21,7 @@ it { is_expected.to validate_uniqueness_of(:external_url).scoped_to(:project_id) } describe '.order_by_last_deployed_at' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let!(:environment1) { create(:environment, project: project) } let!(:environment2) { create(:environment, project: project) } let!(:environment3) { create(:environment, project: project) } diff --git a/spec/models/forked_project_link_spec.rb b/spec/models/forked_project_link_spec.rb index 4e3e450f5acc55b40325d39229459196d3ec089f..8b20036551695631d3d2fcb9b31b972ad5487519 100644 --- a/spec/models/forked_project_link_spec.rb +++ b/spec/models/forked_project_link_spec.rb @@ -50,7 +50,7 @@ def fork_project(from_project, user) end describe '#forked?' do - let(:project_to) { create(:project, forked_project_link: forked_project_link) } + let(:project_to) { create(:project, :repository, forked_project_link: forked_project_link) } let(:forked_project_link) { create(:forked_project_link) } before do diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 6bc16a93bc8a854ef99803316487a47e9db986f1..cd94bbcfe5ab71ddd9c8c413bf38a9cc741ac4d1 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -745,7 +745,7 @@ end describe '#check_for_spam' do - let(:project) { create :project, visibility_level: visibility_level } + let(:project) { create :empty_project, visibility_level: visibility_level } let(:issue) { create :issue, project: project } subject do diff --git a/spec/models/project_group_link_spec.rb b/spec/models/project_group_link_spec.rb index d68d8b719cdd5a6abb2ae14e47e44c7638fa7be2..0938a7b1b6dfa3912c20c6c32c1beb3d0f1c2e1c 100644 --- a/spec/models/project_group_link_spec.rb +++ b/spec/models/project_group_link_spec.rb @@ -9,7 +9,7 @@ describe "Validation" do let(:parent_group) { create(:group) } let(:group) { create(:group, parent: parent_group) } - let(:project) { create(:project, group: group) } + let(:project) { create(:empty_project, group: group) } let!(:project_group_link) { create(:project_group_link, project: project) } it { is_expected.to validate_presence_of(:project_id) } diff --git a/spec/models/project_mirror_data_spec.rb b/spec/models/project_mirror_data_spec.rb index 2b36e896feb40057dff89721b68d365ba80e9fe2..43d1cbe3e132e4742ed5ba838c8c76355037d9da 100644 --- a/spec/models/project_mirror_data_spec.rb +++ b/spec/models/project_mirror_data_spec.rb @@ -28,7 +28,7 @@ end describe '#reset_retry_count!' do - let(:mirror_data) { create(:project, :mirror, :import_finished).mirror_data } + let(:mirror_data) { create(:empty_project, :mirror, :import_finished).mirror_data } it 'resets retry_count to 0' do mirror_data.retry_count = 3 @@ -38,7 +38,7 @@ end describe '#increment_retry_count!' do - let(:mirror_data) { create(:project, :mirror, :import_finished).mirror_data } + let(:mirror_data) { create(:empty_project, :mirror, :import_finished).mirror_data } it 'increments retry_count' do expect { mirror_data.increment_retry_count! }.to change { mirror_data.retry_count }.from(0).to(1) @@ -46,7 +46,7 @@ end describe '#set_next_execution_timestamp!' do - let(:mirror_data) { create(:project, :mirror, :import_finished).mirror_data } + let(:mirror_data) { create(:empty_project, :mirror, :import_finished).mirror_data } let!(:timestamp) { Time.now } let!(:jitter) { 2.seconds } let(:interval) { 2.minutes } diff --git a/spec/models/project_services/chat_notification_service_spec.rb b/spec/models/project_services/chat_notification_service_spec.rb index 413ceed73bf7f1e308e601b6d34bc0b29e099f1d..ae80c4ae002b0a43d655fab236283d821dbfbebf 100644 --- a/spec/models/project_services/chat_notification_service_spec.rb +++ b/spec/models/project_services/chat_notification_service_spec.rb @@ -20,7 +20,7 @@ context 'with repository' do it 'returns true' do - subject.project = create(:project) + subject.project = create(:project, :repository) expect(subject.can_test?).to be true end diff --git a/spec/models/project_services/issue_tracker_service_spec.rb b/spec/models/project_services/issue_tracker_service_spec.rb index e6a1752576bc20b94367de39bfbad99227c97c66..3ca123cb75d94325406c9085e7a236ccf40af3dc 100644 --- a/spec/models/project_services/issue_tracker_service_spec.rb +++ b/spec/models/project_services/issue_tracker_service_spec.rb @@ -2,7 +2,7 @@ describe IssueTrackerService do describe 'Validations' do - let(:project) { create :project } + let(:project) { create :empty_project } describe 'only one issue tracker per project' do let(:service) { RedmineService.new(project: project, active: true) } diff --git a/spec/models/project_services/jenkins_deprecated_service_spec.rb b/spec/models/project_services/jenkins_deprecated_service_spec.rb index bdb23fe03a758a0d9795edd9a4dea32bd9048d6a..71c8a44e7930ae280ec9667e518c1f48bc5579ad 100644 --- a/spec/models/project_services/jenkins_deprecated_service_spec.rb +++ b/spec/models/project_services/jenkins_deprecated_service_spec.rb @@ -62,7 +62,7 @@ def status_body_for_icon(state) end describe 'multiproject enabled' do - let!(:project) { create(:project) } + let!(:project) { create(:empty_project) } before do @service = JenkinsDeprecatedService.new allow(@service).to receive_messages( @@ -123,7 +123,7 @@ def status_body_for_icon(state) describe '#execute' do let(:user) { create(:user, username: 'username') } let(:namespace) { create(:group, :private) } - let(:project) { create(:project, :private, name: 'project', namespace: namespace) } + let(:project) { create(:empty_project, :private, name: 'project', namespace: namespace) } let(:push_sample_data) { Gitlab::DataBuilder::Push.build_sample(project, user) } let(:jenkins_service) { described_class.create(active: true, project: project) } let!(:service_hook) { create(:service_hook, service: jenkins_service) } diff --git a/spec/models/project_services/jenkins_service_spec.rb b/spec/models/project_services/jenkins_service_spec.rb index a61be122ec5f24dcef089c2b60495e6a53c0ad42..7afdef4b88869ffed6a719f4cb329b1e556a26ec 100644 --- a/spec/models/project_services/jenkins_service_spec.rb +++ b/spec/models/project_services/jenkins_service_spec.rb @@ -6,7 +6,7 @@ it { is_expected.to have_one :service_hook } end - let(:project) { create(:project) } + let(:project) { create(:empty_project) } let(:jenkins_url) { 'http://jenkins.example.com/' } let(:jenkins_hook_url) { jenkins_url + 'project/my_project' } @@ -125,7 +125,7 @@ describe '#test' do it 'returns the right status' do user = create(:user, username: 'username') - project = create(:project, name: 'project') + project = create(:empty_project, name: 'project') push_sample_data = Gitlab::DataBuilder::Push.build_sample(project, user) jenkins_service = described_class.create(jenkins_params) stub_request(:post, jenkins_hook_url).with(headers: { 'Authorization' => jenkins_authorization }) @@ -155,7 +155,7 @@ describe '#execute' do let(:user) { create(:user, username: 'username') } let(:namespace) { create(:group, :private) } - let(:project) { create(:project, :private, name: 'project', namespace: namespace) } + let(:project) { create(:empty_project, :private, name: 'project', namespace: namespace) } let(:push_sample_data) { Gitlab::DataBuilder::Push.build_sample(project, user) } let(:jenkins_service) { described_class.create(jenkins_params) } @@ -217,7 +217,7 @@ end describe 'Stored password invalidation' do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } context 'when a password was previously set' do before do @@ -268,7 +268,7 @@ context 'when no password was previously set' do before do @jenkins_service = described_class.create( - project: create(:project), + project: create(:empty_project), properties: { jenkins_url: 'http://jenkins.example.com/', username: 'jenkins' diff --git a/spec/models/project_services/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index 6836d4926297c195bafc514f19bd4ce3bf270501..5f71c86b64a59d34d0dee4dd7174fdcbb0c3ea90 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -190,7 +190,7 @@ describe '#test_settings' do let(:jira_service) do described_class.new( - project: create(:project), + project: create(:empty_project), url: 'http://jira.example.com', username: 'jira_username', password: 'jira_password' diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index f48cc189fac929463f4e34e81e9695d89a5419d8..6077d21e731db8dccf81371a2611baac7b3fb861 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -126,7 +126,7 @@ context '#with_wiki_enabled' do it 'returns a project' do project = create(:project_empty_repo, wiki_access_level: ProjectFeature::ENABLED) - project1 = create(:project, wiki_access_level: ProjectFeature::DISABLED) + project1 = create(:empty_project, wiki_access_level: ProjectFeature::DISABLED) expect(described_class.with_wiki_enabled).to include(project) expect(described_class.with_wiki_enabled).not_to include(project1) @@ -201,7 +201,7 @@ context '#mark_stuck_remote_mirrors_as_failed!' do it 'fails stuck remote mirrors' do - project = create(:project, :remote_mirror) + project = create(:project, :remote_mirror, :repository) project.remote_mirrors.first.update_attributes( update_status: :started, @@ -215,7 +215,7 @@ end context 'mirror' do - subject { build(:project, mirror: true) } + subject { build(:empty_project, mirror: true) } it { is_expected.to validate_presence_of(:import_url) } it { is_expected.to validate_presence_of(:mirror_user) } @@ -299,27 +299,27 @@ describe 'path validation' do it 'allows paths reserved on the root namespace' do - project = build(:project, path: 'api') + project = build(:empty_project, path: 'api') expect(project).to be_valid end it 'rejects paths reserved on another level' do - project = build(:project, path: 'tree') + project = build(:empty_project, path: 'tree') expect(project).not_to be_valid end it 'rejects nested paths' do parent = create(:group, :nested, path: 'environments') - project = build(:project, path: 'folders', namespace: parent) + project = build(:empty_project, path: 'folders', namespace: parent) expect(project).not_to be_valid end it 'allows a reserved group name' do parent = create(:group) - project = build(:project, path: 'avatar', namespace: parent) + project = build(:empty_project, path: 'avatar', namespace: parent) expect(project).to be_valid end @@ -1627,7 +1627,7 @@ def create_pipeline describe 'handling import URL' do context 'when project is a mirror' do it 'returns the full URL' do - project = create(:project, :mirror, import_url: 'http://user:pass@test.com') + project = create(:empty_project, :mirror, import_url: 'http://user:pass@test.com') project.import_finish @@ -1637,7 +1637,7 @@ def create_pipeline context 'when project is not a mirror' do it 'returns the sanitized URL' do - project = create(:project, import_status: 'started', import_url: 'http://user:pass@test.com') + project = create(:empty_project, import_status: 'started', import_url: 'http://user:pass@test.com') project.import_finish @@ -1878,7 +1878,7 @@ def create_pipeline end context 'elasticsearch indexing enabled' do - let(:project) { create(:project, :import_started, import_type: :github) } + let(:project) { create(:empty_project, :import_started, import_type: :github) } before do stub_application_setting(elasticsearch_indexing: true) @@ -1988,7 +1988,7 @@ def create_build(new_pipeline = pipeline, name = 'test') context 'when mirror is expected to run soon' do it 'returns true' do timestamp = Time.now - project = create(:project, :mirror, :import_finished) + project = create(:project, :mirror, :import_finished, :repository) project.mirror_last_update_at = timestamp - 3.minutes project.mirror_data.next_execution_timestamp = timestamp - 2.minutes @@ -1999,7 +1999,7 @@ def create_build(new_pipeline = pipeline, name = 'test') context 'when mirror was scheduled' do it 'returns true' do - project = create(:project, :mirror, :import_scheduled) + project = create(:project, :mirror, :import_scheduled, :repository) expect(project.scheduled_mirror?).to be true end @@ -2017,7 +2017,7 @@ def create_build(new_pipeline = pipeline, name = 'test') context 'when project is not a mirror' do it 'returns false' do - project = create(:project, :import_started) + project = create(:empty_project, :import_started) expect(project.updating_mirror?).to be false end @@ -2025,7 +2025,7 @@ def create_build(new_pipeline = pipeline, name = 'test') context 'when mirror is in progress' do it 'returns true' do - project = create(:project, :mirror, :import_started) + project = create(:project, :mirror, :import_started, :repository) expect(project.updating_mirror?).to be true end @@ -2035,7 +2035,7 @@ def create_build(new_pipeline = pipeline, name = 'test') describe '#force_import_job!' do it 'sets next execution timestamp to now and schedules UpdateAllMirrorsWorker' do timestamp = Time.now - project = create(:project, :mirror) + project = create(:empty_project, :mirror) project.mirror_data.update_attributes(next_execution_timestamp: timestamp - 3.minutes) @@ -2062,7 +2062,7 @@ def create_build(new_pipeline = pipeline, name = 'test') context 'without mirror' do it 'returns nil' do - project = create(:project) + project = create(:empty_project) expect(project.add_import_job).to be_nil end @@ -2080,7 +2080,7 @@ def create_build(new_pipeline = pipeline, name = 'test') context 'with mirror' do it 'schedules RepositoryUpdateMirrorWorker' do - project = create(:project, :mirror) + project = create(:project, :mirror, :repository) expect(RepositoryUpdateMirrorWorker).to receive(:perform_async).with(project.id) @@ -2188,8 +2188,8 @@ def create_build(new_pipeline = pipeline, name = 'test') end context 'with valid paths' do - let!(:project1) { create(:project) } - let!(:project2) { create(:project) } + let!(:project1) { create(:empty_project) } + let!(:project2) { create(:empty_project) } it 'returns the projects matching the paths' do projects = described_class.where_full_path_in([project1.full_path, @@ -2222,8 +2222,8 @@ def create_build(new_pipeline = pipeline, name = 'test') end describe '#change_repository_storage' do - let(:project) { create(:project, repository_storage: 'a') } - let(:read_only_project) { create(:project, repository_storage: 'a', repository_read_only: true) } + let(:project) { create(:project, :repository, repository_storage: 'a') } + let(:read_only_project) { create(:project, :repository, repository_storage: 'a', repository_read_only: true) } before do FileUtils.mkdir('tmp/tests/storage_a') @@ -2336,7 +2336,7 @@ def create_build(new_pipeline = pipeline, name = 'test') end describe '#repository_and_lfs_size' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:size) { 50 } before do @@ -2355,7 +2355,7 @@ def create_build(new_pipeline = pipeline, name = 'test') group = create :group group1 = create :group - project = create :project + project = create :empty_project project.approver_group_ids = "#{group.id}, #{group1.id}" project.save! @@ -2506,7 +2506,7 @@ def create_build(new_pipeline = pipeline, name = 'test') describe '#create_mirror_data' do it 'it is called after save' do - project = create(:project) + project = create(:empty_project) expect(project).to receive(:create_mirror_data) @@ -2526,7 +2526,7 @@ def create_build(new_pipeline = pipeline, name = 'test') end describe '#route_map_for' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:route_map) do <<-MAP.strip_heredoc - source: /source/(.*)/ @@ -2563,7 +2563,7 @@ def create_build(new_pipeline = pipeline, name = 'test') end describe '#public_path_for_source_path' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:route_map) do Gitlab::RouteMap.new(<<-MAP.strip_heredoc) - source: /source/(.*)/ @@ -2677,7 +2677,7 @@ def enable_lfs end describe '#pipeline_status' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } it 'builds a pipeline status' do expect(project.pipeline_status).to be_a(Gitlab::Cache::Ci::ProjectPipelineStatus) end @@ -2688,7 +2688,7 @@ def enable_lfs end describe '#append_or_update_attribute' do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } it 'shows full error updating an invalid MR' do error_message = 'Failed to replace merge_requests because one or more of the new records could not be saved.'\ diff --git a/spec/models/project_team_spec.rb b/spec/models/project_team_spec.rb index 68228a038a8e7828a8cb1bb4e88f8212b76befb7..9ccd366a48e51f69ae2267ee74710192347ae522 100644 --- a/spec/models/project_team_spec.rb +++ b/spec/models/project_team_spec.rb @@ -330,7 +330,7 @@ end shared_examples 'max member access for users' do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } let(:group) { create(:group) } let(:second_group) { create(:group) } diff --git a/spec/models/remote_mirror_spec.rb b/spec/models/remote_mirror_spec.rb index 569184155f80879a60223bebf6cc25da1439f28a..9dc62c8ed51a4ea845bf4edf8a92fff5da2c3c3a 100644 --- a/spec/models/remote_mirror_spec.rb +++ b/spec/models/remote_mirror_spec.rb @@ -86,7 +86,7 @@ end context '#sync' do - let(:remote_mirror) { create(:project, :remote_mirror).remote_mirrors.first } + let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first } before do Timecop.freeze(Time.now) @@ -142,7 +142,7 @@ end context '#updated_since?' do - let(:remote_mirror) { create(:project, :remote_mirror).remote_mirrors.first } + let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first } let(:timestamp) { Time.now - 5.minutes } before do @@ -192,7 +192,7 @@ end def create_mirror(params) - project = FactoryGirl.create(:project) + project = FactoryGirl.create(:project, :repository) project.remote_mirrors.create!(params) end end diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 611c63436456ecf8d0328ddf4155fc42cb2de205..fce2d23333431586ea6e4bc4d63c8bab0b787efa 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -300,7 +300,7 @@ end context "when committing to another project" do - let(:forked_project) { create(:project) } + let(:forked_project) { create(:project, :repository) } it "creates a fork and commit to the forked project" do expect do @@ -1422,8 +1422,8 @@ def merge(repository, user, merge_request, options = {}) describe "class method find_commits_by_message_with_elastic" do it "returns commits" do - project = create :project - project1 = create :project + project = create :project, :repository + project1 = create :project, :repository project.repository.index_commits project1.repository.index_commits @@ -1438,7 +1438,7 @@ def merge(repository, user, merge_request, options = {}) describe "find_commits_by_message_with_elastic" do it "returns commits" do - project = create :project + project = create :project, :repository project.repository.index_commits diff --git a/spec/models/sent_notification_spec.rb b/spec/models/sent_notification_spec.rb index 8b6b02916ae662dc2ccd35799bf6bdc09e51a140..8f05deb8b1526fd5ab6aaf4ef8fb780a7490162b 100644 --- a/spec/models/sent_notification_spec.rb +++ b/spec/models/sent_notification_spec.rb @@ -21,7 +21,7 @@ end context "when the noteable project and discussion project match" do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:issue) { create(:issue, project: project) } let(:discussion_id) { create(:note, project: project, noteable: issue).discussion_id } subject { build(:sent_notification, project: project, noteable: issue, in_reply_to_discussion_id: discussion_id) } @@ -128,7 +128,7 @@ end context 'for commit' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:commit) { project.commit } subject { described_class.record(commit, project.creator.id) } diff --git a/spec/policies/ci/build_policy_spec.rb b/spec/policies/ci/build_policy_spec.rb index a83a83a734965c05ceb295091da22135e802b711..11a4c3c742ee0b35fd6934bf0cd1c7c073dda1c5 100644 --- a/spec/policies/ci/build_policy_spec.rb +++ b/spec/policies/ci/build_policy_spec.rb @@ -97,7 +97,7 @@ end describe 'rules for protected ref' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:build) { create(:ci_build, ref: 'some-ref', pipeline: pipeline) } before do diff --git a/spec/policies/ci/pipeline_policy_spec.rb b/spec/policies/ci/pipeline_policy_spec.rb index b11b06d301f1a26d39dcd2b5f4e4b6e53f6b9479..48a8064c5fc18a85e25412d29c6276f310b6220c 100644 --- a/spec/policies/ci/pipeline_policy_spec.rb +++ b/spec/policies/ci/pipeline_policy_spec.rb @@ -10,7 +10,7 @@ describe 'rules' do describe 'rules for protected ref' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } before do project.add_developer(user) diff --git a/spec/policies/environment_policy_spec.rb b/spec/policies/environment_policy_spec.rb index 035e20c745203ef0c22cb998bcc9080f4effae68..de4cb5b30c5b587493fdff0c798506d99a7bdab3 100644 --- a/spec/policies/environment_policy_spec.rb +++ b/spec/policies/environment_policy_spec.rb @@ -2,7 +2,7 @@ describe EnvironmentPolicy do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:environment) do create(:environment, :with_review_app, project: project) @@ -14,7 +14,7 @@ describe '#rules' do context 'when user does not have access to the project' do - let(:project) { create(:project, :private) } + let(:project) { create(:project, :private, :repository) } it 'does not include ability to stop environment' do expect(policy).to be_disallowed :stop_environment @@ -22,7 +22,7 @@ end context 'when anonymous user has access to the project' do - let(:project) { create(:project, :public) } + let(:project) { create(:project, :public, :repository) } it 'does not include ability to stop environment' do expect(policy).to be_disallowed :stop_environment @@ -30,7 +30,7 @@ end context 'when team member has access to the project' do - let(:project) { create(:project, :public) } + let(:project) { create(:project, :public, :repository) } before do project.add_developer(user) diff --git a/spec/presenters/merge_request_presenter_spec.rb b/spec/presenters/merge_request_presenter_spec.rb index 45c825e099579f93995f2ec58e16bb56a39573c4..01abeb001693bea27bb5c3b189644adcddc553f2 100644 --- a/spec/presenters/merge_request_presenter_spec.rb +++ b/spec/presenters/merge_request_presenter_spec.rb @@ -105,7 +105,7 @@ end context 'issues links' do - let(:project) { create(:project, :private, creator: user, namespace: user.namespace) } + let(:project) { create(:project, :private, :repository, creator: user, namespace: user.namespace) } let(:issue_a) { create(:issue, project: project) } let(:issue_b) { create(:issue, project: project) } diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb index 9e268adf95033c5c29cbcf6ee930f55da729659d..55c998b13b8f4dc30aa384dc239c9ddb61222fa8 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -80,7 +80,7 @@ def route(file_path = nil) context 'when unauthenticated', 'and project is public' do it_behaves_like 'repository files' do - let(:project) { create(:project, :public) } + let(:project) { create(:project, :public, :repository) } let(:current_user) { nil } end end @@ -153,7 +153,7 @@ def route(file_path = nil) context 'when unauthenticated', 'and project is public' do it_behaves_like 'repository raw files' do - let(:project) { create(:project, :public) } + let(:project) { create(:project, :public, :repository) } let(:current_user) { nil } end end diff --git a/spec/requests/api/members_spec.rb b/spec/requests/api/members_spec.rb index 3ebc622e8233b6a4db2c386ae0928308d814fabf..af1955dd425488e503933d4741657492dfe8676d 100644 --- a/spec/requests/api/members_spec.rb +++ b/spec/requests/api/members_spec.rb @@ -185,7 +185,7 @@ context 'project in a group' do it 'returns a 405 method not allowed error when group membership lock is enabled' do group_with_membership_locked = create(:group, membership_lock: true) - project = create(:project, group: group_with_membership_locked) + project = create(:empty_project, group: group_with_membership_locked) project.group.add_owner(master) post api("/projects/#{project.id}/members", master), diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index b34555d2815e442f3e0395f16a5d2c57333462a8..9ff2b782b52c511d54cbd1786412ade294751610 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -3,7 +3,7 @@ describe API::PipelineSchedules do set(:developer) { create(:user) } set(:user) { create(:user) } - set(:project) { create(:project) } + set(:project) { create(:project, :repository) } before do project.add_developer(developer) diff --git a/spec/requests/api/project_push_rule_spec.rb b/spec/requests/api/project_push_rule_spec.rb index fa614cb7c9b9fa5ede6e5f15baec4c7466e229e2..37a956070c40787d013dc21b559a722258360c7e 100644 --- a/spec/requests/api/project_push_rule_spec.rb +++ b/spec/requests/api/project_push_rule_spec.rb @@ -4,7 +4,7 @@ include ApiHelpers let(:user) { create(:user) } let(:user3) { create(:user) } - let!(:project) { create(:project, creator_id: user.id, namespace: user.namespace) } + let!(:project) { create(:project, :repository, creator_id: user.id, namespace: user.namespace) } before do project.team << [user, :master] diff --git a/spec/requests/api/todos_spec.rb b/spec/requests/api/todos_spec.rb index 92533f4dfea18c5a91180a60fb20bf7256b989e6..f5413913c1eb39d52a2331c7548e9599c6b2e855 100644 --- a/spec/requests/api/todos_spec.rb +++ b/spec/requests/api/todos_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe API::Todos do - let(:project_1) { create(:empty_project, :test_repo) } + let(:project_1) { create(:project, :repository) } let(:project_2) { create(:empty_project) } let(:author_1) { create(:user) } let(:author_2) { create(:user) } diff --git a/spec/requests/api/triggers_spec.rb b/spec/requests/api/triggers_spec.rb index 88fe7e682b94ce46682accfa2a5e387efe088fb4..da5ecdbdfa6ed2c167ec93d2abc5dccc4624819e 100644 --- a/spec/requests/api/triggers_spec.rb +++ b/spec/requests/api/triggers_spec.rb @@ -13,7 +13,7 @@ let!(:trigger_request) { create(:ci_trigger_request, trigger: trigger, created_at: '2015-01-01 12:13:14') } describe 'POST /projects/:project_id/trigger/pipeline' do - let!(:project2) { create(:project) } + let!(:project2) { create(:project, :repository) } let(:options) do { token: trigger_token diff --git a/spec/requests/api/v3/files_spec.rb b/spec/requests/api/v3/files_spec.rb index 8b2d165c7633d2284b362f51b9f598a9cb4a42e7..4ffa5d1784e959b7f9b956bcb554805b93675997 100644 --- a/spec/requests/api/v3/files_spec.rb +++ b/spec/requests/api/v3/files_spec.rb @@ -74,7 +74,7 @@ context 'when unauthenticated', 'and project is public' do it_behaves_like 'repository files' do - let(:project) { create(:project, :public) } + let(:project) { create(:project, :public, :repository) } let(:current_user) { nil } end end diff --git a/spec/requests/api/v3/project_hooks_spec.rb b/spec/requests/api/v3/project_hooks_spec.rb index 1969d1c7f2b8b7e89d9a456d6a2f3c08f841cb05..4c2ca4f7d9a732e749fb00c7cc10157c62a9b153 100644 --- a/spec/requests/api/v3/project_hooks_spec.rb +++ b/spec/requests/api/v3/project_hooks_spec.rb @@ -3,7 +3,7 @@ describe API::ProjectHooks, 'ProjectHooks' do let(:user) { create(:user) } let(:user3) { create(:user) } - let!(:project) { create(:project, creator_id: user.id, namespace: user.namespace) } + let!(:project) { create(:empty_project, creator_id: user.id, namespace: user.namespace) } let!(:hook) do create(:project_hook, :all_events_enabled, @@ -204,7 +204,7 @@ it "returns a 404 if a user attempts to delete project hooks he/she does not own" do test_user = create(:user) - other_project = create(:project) + other_project = create(:empty_project) other_project.team << [test_user, :master] delete v3_api("/projects/#{other_project.id}/hooks/#{hook.id}", test_user) diff --git a/spec/requests/api/v3/project_push_rule_spec.rb b/spec/requests/api/v3/project_push_rule_spec.rb index cc07ab11a240263c53923aeb039013856027a19a..68660eb06c74ba992b8895642635f8aad096cdbb 100644 --- a/spec/requests/api/v3/project_push_rule_spec.rb +++ b/spec/requests/api/v3/project_push_rule_spec.rb @@ -4,7 +4,7 @@ include ApiHelpers let(:user) { create(:user) } let(:user3) { create(:user) } - let!(:project) { create(:project, creator_id: user.id, namespace: user.namespace) } + let!(:project) { create(:project, :repository, creator_id: user.id, namespace: user.namespace) } before do project.team << [user, :master] diff --git a/spec/requests/api/v3/triggers_spec.rb b/spec/requests/api/v3/triggers_spec.rb index 60212660fb60ced1100282535f1095fd27ed3cbb..2a593dd81352628c3a50b9810a7ce643a05d40e1 100644 --- a/spec/requests/api/v3/triggers_spec.rb +++ b/spec/requests/api/v3/triggers_spec.rb @@ -10,7 +10,7 @@ let!(:trigger) { create(:ci_trigger, project: project, token: trigger_token) } describe 'POST /projects/:project_id/trigger' do - let!(:project2) { create(:project) } + let!(:project2) { create(:empty_project) } let(:options) do { token: trigger_token diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb index fc96be8c8040c26b2289c3038365294bd1c06850..909d3d839c2aaf53ba2deea6592ae86a1047a076 100644 --- a/spec/requests/lfs_http_spec.rb +++ b/spec/requests/lfs_http_spec.rb @@ -600,7 +600,7 @@ context 'when user is not authenticated' do describe 'is accessing public project' do - let(:project) { create(:project, :public) } + let(:project) { create(:empty_project, :public) } let(:update_lfs_permissions) do project.lfs_objects << lfs_object @@ -642,7 +642,7 @@ end describe 'upload' do - let(:project) { create(:project, :public) } + let(:project) { create(:empty_project, :public) } let(:body) do { 'operation' => 'upload', @@ -1069,7 +1069,7 @@ end describe 'to a forked project' do - let(:upstream_project) { create(:project, :public) } + let(:upstream_project) { create(:empty_project, :public) } let(:project_owner) { create(:user) } let(:project) { fork_project(upstream_project, project_owner) } diff --git a/spec/requests/projects/mirrors_controller_spec.rb b/spec/requests/projects/mirrors_controller_spec.rb index c4cd65b93f797762b938b84cf8464e40071204e3..1cbea491659e1f0c3184496640948f608f7576b5 100644 --- a/spec/requests/projects/mirrors_controller_spec.rb +++ b/spec/requests/projects/mirrors_controller_spec.rb @@ -2,7 +2,7 @@ describe Projects::MirrorsController do let(:project) do - create(:project, + create(:project, :repository, mirror: true, mirror_user: user, import_url: 'http://user:pass@test.url') diff --git a/spec/requests/request_profiler_spec.rb b/spec/requests/request_profiler_spec.rb index 9afeb2983b0a633254f5d5920e557ac2811d7c98..1325ba37fd8eb8f0209878a8db73da2c886132c7 100644 --- a/spec/requests/request_profiler_spec.rb +++ b/spec/requests/request_profiler_spec.rb @@ -13,7 +13,7 @@ end it 'creates a profile of the request' do - project = create(:project, namespace: user.namespace) + project = create(:empty_project, namespace: user.namespace) time = Time.now path = "/#{project.full_path}" diff --git a/spec/routing/webhook_routes_spec.rb b/spec/routing/webhook_routes_spec.rb index 4167e9a2fae6a1ad80678f8d0fdd3402beba9343..d7876ed87fb6fe0d1a5e9fab8a504bc920efff54 100644 --- a/spec/routing/webhook_routes_spec.rb +++ b/spec/routing/webhook_routes_spec.rb @@ -2,7 +2,7 @@ describe "routes to the proper webhooks controller", type: :routing do context 'with a project context' do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } let(:project_hook) { create(:project_hook) } it "routes the test action" do diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 4ec495f612e8daecee6038d73e3a44bf771b7d40..730df4e033631c1625a6eb48060325bbb53cc3de 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -75,7 +75,7 @@ def execute_service( end context 'when merge request target project is different from source project' do - let!(:target_project) { create(:project) } + let!(:target_project) { create(:project, :repository) } let!(:forked_project_link) { create(:forked_project_link, forked_to_project: project, forked_from_project: target_project) } it 'updates head pipeline for merge request' do diff --git a/spec/services/ci/play_build_service_spec.rb b/spec/services/ci/play_build_service_spec.rb index 1ced26ff98d5f28cc8d3ab0976a79d2327083dee..04f926ccb32b6d0f7b72e75ef89f610e145a8afc 100644 --- a/spec/services/ci/play_build_service_spec.rb +++ b/spec/services/ci/play_build_service_spec.rb @@ -33,7 +33,7 @@ end context 'when project has repository' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } it 'allows user with developer role to play a build' do project.add_developer(user) diff --git a/spec/services/ee/issues/build_service_spec.rb b/spec/services/ee/issues/build_service_spec.rb index ad82dc4ac28c1d1d2e4217e3d9515d944ceacbbf..0f20cea23ff4867aeb3a7ec8d4ea53e158956493 100644 --- a/spec/services/ee/issues/build_service_spec.rb +++ b/spec/services/ee/issues/build_service_spec.rb @@ -11,7 +11,7 @@ context 'with an issue template' do describe '#execute' do it 'fills in the template in the description' do - project = build(:project, issues_template: 'Work hard, play hard!') + project = build(:empty_project, issues_template: 'Work hard, play hard!') service = described_class.new(project, user) issue = service.execute diff --git a/spec/services/geo/move_repository_service_spec.rb b/spec/services/geo/move_repository_service_spec.rb index ad2ac716267ac85957742ff676014caea6a504a1..43905c7908e65998501d31552ef5392f38b178e6 100644 --- a/spec/services/geo/move_repository_service_spec.rb +++ b/spec/services/geo/move_repository_service_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Geo::MoveRepositoryService do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:new_path) { project.full_path + '+renamed' } let(:full_new_path) { File.join(project.repository_storage_path, new_path) } subject { described_class.new(project.id, project.name, project.full_path, new_path) } diff --git a/spec/services/geo/repository_updated_event_store_spec.rb b/spec/services/geo/repository_updated_event_store_spec.rb index 5793b1aa51aad9a4ca311846887900c51425ce3d..f5fc684e0c6f5d26eff73ed08ac8e9539aef3224 100644 --- a/spec/services/geo/repository_updated_event_store_spec.rb +++ b/spec/services/geo/repository_updated_event_store_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Geo::RepositoryUpdatedEventStore do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:blankrev) { Gitlab::Git::BLANK_SHA } let(:refs) { ['refs/heads/tést', 'refs/tags/tag'] } diff --git a/spec/services/geo/schedule_repo_create_service_spec.rb b/spec/services/geo/schedule_repo_create_service_spec.rb index 456194140630190cb6cf030ad6326bf94188ee30..200f0593717196eaf9846cd2f619944f36a7dda0 100644 --- a/spec/services/geo/schedule_repo_create_service_spec.rb +++ b/spec/services/geo/schedule_repo_create_service_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Geo::ScheduleRepoCreateService do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } subject { described_class.new(project_id: project.id) } describe '#execute' do diff --git a/spec/services/geo/schedule_repo_update_service_spec.rb b/spec/services/geo/schedule_repo_update_service_spec.rb index 404f14127ff88bc9d76503bb568e8dd0086f0c0b..68e8e86e9c7d43754f8b5ae6bcb430aee30dbf76 100644 --- a/spec/services/geo/schedule_repo_update_service_spec.rb +++ b/spec/services/geo/schedule_repo_update_service_spec.rb @@ -4,7 +4,7 @@ include RepoHelpers let(:user) { create :user } - let(:project) { create :project } + let(:project) { create :project, :repository } let(:blankrev) { Gitlab::Git::BLANK_SHA } let(:oldrev) { sample_commit.parent_id } diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index 86506b2909d5147f656e1908c7dd05466df6e03c..0e590c1433e80904fee292ead8690800fa2375fb 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -15,7 +15,7 @@ end describe 'with remote mirrors' do - let(:project) { create(:project, :remote_mirror) } + let(:project) { create(:project, :repository, :remote_mirror) } subject do described_class.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref) diff --git a/spec/services/labels/create_service_spec.rb b/spec/services/labels/create_service_spec.rb index ecb88653001f018cac8928deddb5bb54ec9772de..9ff3a5375b9e1051ad4c8b23ff67ffcc3ba90681 100644 --- a/spec/services/labels/create_service_spec.rb +++ b/spec/services/labels/create_service_spec.rb @@ -2,9 +2,9 @@ describe Labels::CreateService do describe '#execute' do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } let(:group) { create(:group) } - + let(:hex_color) { '#FF0000' } let(:named_color) { 'red' } let(:upcase_color) { 'RED' } diff --git a/spec/services/labels/update_service_spec.rb b/spec/services/labels/update_service_spec.rb index bb95fe20fbf6c869a10a69384ce6f786741a15ca..f0bec7e9f9cc5aacd7ecd93ed50eb447da1ac0bf 100644 --- a/spec/services/labels/update_service_spec.rb +++ b/spec/services/labels/update_service_spec.rb @@ -2,7 +2,7 @@ describe Labels::UpdateService do describe '#execute' do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } let(:hex_color) { '#FF0000' } let(:named_color) { 'red' } diff --git a/spec/services/merge_requests/squash_service_spec.rb b/spec/services/merge_requests/squash_service_spec.rb index 141aedee13a984d262b761c6263e049b19637453..ac46473cf9d6ebd4a386422b9fe04381595be136 100644 --- a/spec/services/merge_requests/squash_service_spec.rb +++ b/spec/services/merge_requests/squash_service_spec.rb @@ -3,7 +3,7 @@ describe MergeRequests::SquashService do let(:service) { described_class.new(project, user, {}) } let(:user) { project.owner } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:merge_request_with_one_commit) do create(:merge_request, diff --git a/spec/services/milestones/destroy_service_spec.rb b/spec/services/milestones/destroy_service_spec.rb index 5739386dd0d4702343b930d96ec1080e4c61c395..f7a6c3d323e084c34f31de80ab1c573ba25e7940 100644 --- a/spec/services/milestones/destroy_service_spec.rb +++ b/spec/services/milestones/destroy_service_spec.rb @@ -2,7 +2,7 @@ describe Milestones::DestroyService do let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:empty_project) } let(:milestone) { create(:milestone, title: 'Milestone v1.0', project: project) } let(:issue) { create(:issue, project: project, milestone: milestone) } let(:merge_request) { create(:merge_request, source_project: project, milestone: milestone) } diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb index e0baeb5d613ecbcda76f7fd9ffe216bfbb5e9320..25501962394b562a996550594034f16704639015 100644 --- a/spec/services/projects/destroy_service_spec.rb +++ b/spec/services/projects/destroy_service_spec.rb @@ -65,7 +65,7 @@ context 'when has remote mirrors' do let!(:project) do - create(:project, namespace: user.namespace).tap do |project| + create(:project, :repository, namespace: user.namespace).tap do |project| project.remote_mirrors.create(url: 'http://test.com') end end diff --git a/spec/services/projects/slack_application_install_service_spec.rb b/spec/services/projects/slack_application_install_service_spec.rb index 17097a13ea5b7011fb8884c24993f31341c88e6f..74bd07edc0ff5e3ab37ef50baae96529d74d5498 100644 --- a/spec/services/projects/slack_application_install_service_spec.rb +++ b/spec/services/projects/slack_application_install_service_spec.rb @@ -2,7 +2,7 @@ describe Projects::SlackApplicationInstallService do let!(:user) { create(:user) } - let!(:project) { create(:project) } + let!(:project) { create(:empty_project) } def service(params = {}) Projects::SlackApplicationInstallService.new(project, user, params) diff --git a/spec/services/projects/update_mirror_service_spec.rb b/spec/services/projects/update_mirror_service_spec.rb index 695131c8df4c5ae96b1442e981a11d92e33b6fd0..5b79f6d29fa400c9b09af198d06c3a6bcf23ef22 100644 --- a/spec/services/projects/update_mirror_service_spec.rb +++ b/spec/services/projects/update_mirror_service_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Projects::UpdateMirrorService do - let(:project) { create(:project, :mirror, import_url: Project::UNKNOWN_IMPORT_URL) } + let(:project) { create(:project, :repository, :mirror, import_url: Project::UNKNOWN_IMPORT_URL) } describe "#execute" do context 'unlicensed' do @@ -124,7 +124,7 @@ def create_file(repository) end describe "when is no mirror" do - let(:project) { build_stubbed(:project) } + let(:project) { build_stubbed(:empty_project) } it "success" do expect(project.mirror?).to eq(false) diff --git a/spec/services/projects/update_remote_mirror_service_spec.rb b/spec/services/projects/update_remote_mirror_service_spec.rb index 161167847e461ebceab93a791da08cc164617396..f3fe2a19d6159252ba43c1c7a2f57d0d7a3605c6 100644 --- a/spec/services/projects/update_remote_mirror_service_spec.rb +++ b/spec/services/projects/update_remote_mirror_service_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Projects::UpdateRemoteMirrorService do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:remote_project) { create(:forked_project_with_submodules) } let(:repository) { project.repository } let(:remote_mirror) { project.remote_mirrors.create!(url: remote_project.http_url_to_repo, enabled: true) } diff --git a/spec/services/projects/update_repository_storage_service_spec.rb b/spec/services/projects/update_repository_storage_service_spec.rb index a39c109fdb0f9218227f9cde35914fd83e670ae6..f473a12ce4e2a338d1b09e901343c7cce3a65c53 100644 --- a/spec/services/projects/update_repository_storage_service_spec.rb +++ b/spec/services/projects/update_repository_storage_service_spec.rb @@ -27,7 +27,7 @@ end context 'without wiki', skip_gitaly_mock: true do - let(:project) { create(:project, repository_storage: 'a', repository_read_only: true, wiki_enabled: false) } + let(:project) { create(:project, :repository, repository_storage: 'a', repository_read_only: true, wiki_enabled: false) } context 'when the move succeeds' do it 'moves the repository to the new storage and unmarks the repository as read only' do @@ -63,7 +63,7 @@ end context 'with wiki', skip_gitaly_mock: true do - let(:project) { create(:project, repository_storage: 'a', repository_read_only: true, wiki_enabled: true) } + let(:project) { create(:project, :repository, repository_storage: 'a', repository_read_only: true, wiki_enabled: true) } before do project.create_wiki diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index 6c1aa584bb12a8203db441b9d2b18f23b74536fd..05c3c1fe3397243e0f4005ce436581b20761bfc0 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -137,7 +137,7 @@ describe 'repository_storage' do let(:admin_user) { create(:user, admin: true) } let(:user) { create(:user) } - let(:project) { create(:project, repository_storage: 'a') } + let(:project) { create(:project, :repository, repository_storage: 'a') } let(:opts) { { repository_storage: 'b' } } before do diff --git a/spec/services/slash_commands/global_slack_handler_spec.rb b/spec/services/slash_commands/global_slack_handler_spec.rb index d3c73b8c4b22ce72736a4502384316e947b95107..74d54453f28214756c795218d73a656d49413131 100644 --- a/spec/services/slash_commands/global_slack_handler_spec.rb +++ b/spec/services/slash_commands/global_slack_handler_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe SlashCommands::GlobalSlackHandler do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } let(:user) { create(:user) } let(:verification_token) { '123' } diff --git a/spec/services/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb index fda4495fd690d85c66721168b723da10b17888ad..8fe3f521e3887e014c7d527167c212a41dca4614 100644 --- a/spec/services/users/destroy_service_spec.rb +++ b/spec/services/users/destroy_service_spec.rb @@ -40,7 +40,7 @@ end context "a deleted user's issues" do - let(:project) { create(:project) } + let(:project) { create(:empty_project) } before do project.add_developer(user) @@ -66,7 +66,7 @@ end context "a deleted user's merge_requests" do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } before do project.add_developer(user) diff --git a/spec/services/users/migrate_to_ghost_user_service_spec.rb b/spec/services/users/migrate_to_ghost_user_service_spec.rb index a0030ce88098e5d7a3392ecaab493c289995a72d..ac3a8738cac6b4ffff9097aab51421312c736477 100644 --- a/spec/services/users/migrate_to_ghost_user_service_spec.rb +++ b/spec/services/users/migrate_to_ghost_user_service_spec.rb @@ -2,7 +2,7 @@ describe Users::MigrateToGhostUserService do let!(:user) { create(:user) } - let!(:project) { create(:project) } + let!(:project) { create(:project, :repository) } let(:service) { described_class.new(user) } context "migrating a user's associated records to the ghost user" do diff --git a/spec/support/features/issuable_slash_commands_shared_examples.rb b/spec/support/features/issuable_slash_commands_shared_examples.rb index 035428a7d9b375aa7e345c8eb9bbb5e012c8a30a..47a7fd0c2ea8f4d8d5bb8ca0f1a3d93db4ed4f45 100644 --- a/spec/support/features/issuable_slash_commands_shared_examples.rb +++ b/spec/support/features/issuable_slash_commands_shared_examples.rb @@ -5,7 +5,14 @@ include QuickActionsHelpers let(:master) { create(:user) } - let(:project) { create(:project, :public) } + let(:project) do + case issuable_type + when :merge_request + create(:project, :public, :repository) + when :issue + create(:empty_project, :public) + end + end let!(:milestone) { create(:milestone, project: project, title: 'ASAP') } let!(:label_bug) { create(:label, project: project, title: 'bug') } let!(:label_feature) { create(:label, project: project, title: 'feature') } diff --git a/spec/support/import_export/export_file_helper.rb b/spec/support/import_export/export_file_helper.rb index 57b6abe12b7ca31442e89abea03e4a64860e973b..2011408be935cb64cbb60748c40da7bb607f8063 100644 --- a/spec/support/import_export/export_file_helper.rb +++ b/spec/support/import_export/export_file_helper.rb @@ -6,7 +6,7 @@ module ExportFileHelper ObjectWithParent = Struct.new(:object, :parent, :key_found) def setup_project - project = create(:project, :public) + project = create(:project, :public, :repository) create(:release, project: project) diff --git a/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb b/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb index 855051921f0e2cc788c218c355a4b5bea5b4e811..bbb63a08374aa82c83212038858882d5d8cbe2be 100644 --- a/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb +++ b/spec/support/services/migrate_to_ghost_user_service_shared_examples.rb @@ -3,7 +3,14 @@ shared_examples "migrating a deleted user's associated records to the ghost user" do |record_class, fields| record_class_name = record_class.to_s.titleize.downcase - let(:project) { create(:project) } + let(:project) do + case record_class + when MergeRequest + create(:project, :repository) + else + create(:empty_project) + end + end before do project.add_developer(user) diff --git a/spec/uploaders/file_uploader_spec.rb b/spec/uploaders/file_uploader_spec.rb index 47e9365e13de363b76bbb120978c1967fa137bcc..c2510a10286544aa7e8edb63fb33e7cdd09be567 100644 --- a/spec/uploaders/file_uploader_spec.rb +++ b/spec/uploaders/file_uploader_spec.rb @@ -5,7 +5,7 @@ describe '.absolute_path' do it 'returns the correct absolute path by building it dynamically' do - project = build_stubbed(:project) + project = build_stubbed(:empty_project) upload = double(model: project, path: 'secret/foo.jpg') dynamic_segment = project.path_with_namespace diff --git a/spec/validators/dynamic_path_validator_spec.rb b/spec/validators/dynamic_path_validator_spec.rb index 8bd5306ff986f771890129b042d3e3c32277edce..dd90a836a7890d713a4ec631f643c1c08955c5aa 100644 --- a/spec/validators/dynamic_path_validator_spec.rb +++ b/spec/validators/dynamic_path_validator_spec.rb @@ -28,7 +28,7 @@ def expect_handles_invalid_utf8 describe '#path_valid_for_record?' do context 'for project' do it 'calls valid_project_path?' do - project = build(:project, path: 'activity') + project = build(:empty_project, path: 'activity') expect(described_class).to receive(:valid_project_path?).with(project.full_path).and_call_original diff --git a/spec/views/layouts/nav/_project.html.haml_spec.rb b/spec/views/layouts/nav/_project.html.haml_spec.rb index fd1637ca91b6da3e7ee65598b00467e9f99dc70c..faea2505e407a4c13f6398e9f86fcc77591485ed 100644 --- a/spec/views/layouts/nav/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/_project.html.haml_spec.rb @@ -5,7 +5,7 @@ before do stub_container_registry_config(enabled: true) - assign(:project, create(:project)) + assign(:project, create(:project, :repository)) allow(view).to receive(:current_ref).and_return('master') allow(view).to receive(:can?).and_return(true) diff --git a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb index f627f9165fbadb394d5730a93a7a667df8f6fdda..d9d73f789c5c1c24f0530c9838be315de8150bd8 100644 --- a/spec/views/notify/pipeline_failed_email.html.haml_spec.rb +++ b/spec/views/notify/pipeline_failed_email.html.haml_spec.rb @@ -4,7 +4,7 @@ include Devise::Test::ControllerHelpers let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, :simple, source_project: project) } let(:pipeline) do diff --git a/spec/views/notify/pipeline_success_email.html.haml_spec.rb b/spec/views/notify/pipeline_success_email.html.haml_spec.rb index ecd096ee579e734e8cb6648ac7d3b9c4faa44a24..a793b37e41223542b05bc3c2296ce126ee086c2a 100644 --- a/spec/views/notify/pipeline_success_email.html.haml_spec.rb +++ b/spec/views/notify/pipeline_success_email.html.haml_spec.rb @@ -4,7 +4,7 @@ include Devise::Test::ControllerHelpers let(:user) { create(:user) } - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:merge_request) { create(:merge_request, :simple, source_project: project) } let(:pipeline) do diff --git a/spec/workers/admin_emails_worker_spec.rb b/spec/workers/admin_emails_worker_spec.rb index 3ddef68de9f40b0879b2d295fa0929834d266599..71d79b3866c14de2daa2c87f46ed2a92d9c832a6 100644 --- a/spec/workers/admin_emails_worker_spec.rb +++ b/spec/workers/admin_emails_worker_spec.rb @@ -3,7 +3,7 @@ describe AdminEmailsWorker do context "recipients" do let(:group) { create :group } - let(:project) { create :project } + let(:project) { create :empty_project } before do 2.times do diff --git a/spec/workers/elastic_commit_indexer_worker_spec.rb b/spec/workers/elastic_commit_indexer_worker_spec.rb index 0227b9c88a540d0f9c21d5df813f345ecb6126a0..e9b2873e22ca321f6bc6a2e6518d2aa655b7b728 100644 --- a/spec/workers/elastic_commit_indexer_worker_spec.rb +++ b/spec/workers/elastic_commit_indexer_worker_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe ElasticCommitIndexerWorker do - let!(:project) { create(:project) } + let!(:project) { create(:project, :repository) } subject { described_class.new } diff --git a/spec/workers/elastic_indexer_worker_spec.rb b/spec/workers/elastic_indexer_worker_spec.rb index 8fd02492d93bcb7ce49961c64f2373a417e743c6..b8099747ea8fa7b23397137d78069c4eaeaafc14 100644 --- a/spec/workers/elastic_indexer_worker_spec.rb +++ b/spec/workers/elastic_indexer_worker_spec.rb @@ -174,7 +174,7 @@ project, issue, milestone, note, merge_request = nil Sidekiq::Testing.disable! do - project = create :project + project = create :project, :repository subject.perform("index", "Project", project.id) issue = create :issue, project: project diff --git a/spec/workers/geo_repository_create_worker_spec.rb b/spec/workers/geo_repository_create_worker_spec.rb index 2c8732c60c159410357e76c8b8889b6a8d2d63d2..c7159dc6e34086ec951693b749694453891c8414 100644 --- a/spec/workers/geo_repository_create_worker_spec.rb +++ b/spec/workers/geo_repository_create_worker_spec.rb @@ -2,7 +2,7 @@ describe GeoRepositoryCreateWorker do let(:user) { create :user } - let(:project) { create :project } + let(:project) { create :project, :repository } let(:perform!) { subject.perform(project.id) } before do diff --git a/spec/workers/geo_repository_update_worker_spec.rb b/spec/workers/geo_repository_update_worker_spec.rb index 517635fb7d17b880a51198391d95914625b0cf4f..5f20ccaed48cac180330c5acac946beb6db9f822 100644 --- a/spec/workers/geo_repository_update_worker_spec.rb +++ b/spec/workers/geo_repository_update_worker_spec.rb @@ -4,7 +4,7 @@ include RepoHelpers let(:user) { create :user } - let(:project) { create :project } + let(:project) { create :project, :repository } let(:blankrev) { Gitlab::Git::BLANK_SHA } let(:oldrev) { sample_commit.parent_id } diff --git a/spec/workers/process_commit_worker_spec.rb b/spec/workers/process_commit_worker_spec.rb index 6ebc94bb5444d402c52cf2b51332109b79b86837..24f8ca675944a97ebe9ce3ca7a20aa8f41e2c3ad 100644 --- a/spec/workers/process_commit_worker_spec.rb +++ b/spec/workers/process_commit_worker_spec.rb @@ -33,7 +33,7 @@ end context 'when commit already exists in upstream project' do - let(:forked) { create(:project, :public) } + let(:forked) { create(:project, :public, :repository) } it 'does not process commit message' do create(:forked_project_link, forked_to_project: forked, forked_from_project: project) diff --git a/spec/workers/project_update_repository_storage_worker_spec.rb b/spec/workers/project_update_repository_storage_worker_spec.rb index 759c2b87d8520f4b018b20264ca0fc023e29d1c0..d1dd3558c4d4b612169028da7ddf7bf4a3e0bb9b 100644 --- a/spec/workers/project_update_repository_storage_worker_spec.rb +++ b/spec/workers/project_update_repository_storage_worker_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe ProjectUpdateRepositoryStorageWorker do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } subject { described_class.new } diff --git a/spec/workers/repository_update_mirror_worker_spec.rb b/spec/workers/repository_update_mirror_worker_spec.rb index a4b7915adcf0b8bce8336e2bc6e47afa85cf7cb7..83c963697cbd97006d534e61406c3041577b4802 100644 --- a/spec/workers/repository_update_mirror_worker_spec.rb +++ b/spec/workers/repository_update_mirror_worker_spec.rb @@ -27,7 +27,7 @@ context 'with another worker already running' do it 'raises UpdateAlreadyInProgressError' do - mirror = create(:project, :mirror, :import_started) + mirror = create(:project, :repository, :mirror, :import_started) expect do subject.perform(mirror.id) @@ -37,7 +37,7 @@ context 'with unexpected error' do it 'marks mirror as failed' do - mirror = create(:project, :mirror, :import_scheduled) + mirror = create(:project, :repository, :mirror, :import_scheduled) allow_any_instance_of(Projects::UpdateMirrorService).to receive(:execute).and_raise(RuntimeError) @@ -49,7 +49,7 @@ end context 'threshold_reached?' do - let(:mirror) { create(:project, :mirror, :import_scheduled) } + let(:mirror) { create(:project, :repository, :mirror, :import_scheduled) } before do expect_any_instance_of(Projects::UpdateMirrorService).to receive(:execute).and_return(status: :success) diff --git a/spec/workers/repository_update_remote_mirror_worker_spec.rb b/spec/workers/repository_update_remote_mirror_worker_spec.rb index 750343717e42e9d44bc07f9342617d993d71f417..a94f6da462b3d1fce93be0194834b7ab68b3eb2f 100644 --- a/spec/workers/repository_update_remote_mirror_worker_spec.rb +++ b/spec/workers/repository_update_remote_mirror_worker_spec.rb @@ -3,7 +3,7 @@ describe RepositoryUpdateRemoteMirrorWorker do subject { described_class.new } - let(:remote_mirror) { create(:project, :remote_mirror).remote_mirrors.first } + let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first } let(:scheduled_time) { Time.now - 5.minutes } before do