diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-08-01 14:51:52 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-08-01 14:51:52 -0400 |
commit | 9513bd18c43b749c8856d6ad89635d97c8fb73b5 (patch) | |
tree | b55d7fb920f0d6a8e10eabae1cafa5126fa03203 | |
parent | 4c77c30fbfb3734fd893f7cfe540fa595ea6539c (diff) | |
download | gitlab-ce-9513bd18c43b749c8856d6ad89635d97c8fb73b5.tar.gz |
Ensure all project factories use `:repository` trait or `:empty_project`rs-empty_project-cleanup
115 files changed, 214 insertions, 200 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index 2565622f8df..23ab2b141cf 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -4,7 +4,7 @@ describe Admin::ApplicationSettingsController do 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 6eb9f7867d5..b290c45cdd4 100644 --- a/spec/controllers/admin/dashboard_controller_spec.rb +++ b/spec/controllers/admin/dashboard_controller_spec.rb @@ -8,8 +8,8 @@ describe Admin::DashboardController do 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 58486f33229..fa5660050ec 100644 --- a/spec/controllers/autocomplete_controller_spec.rb +++ b/spec/controllers/autocomplete_controller_spec.rb @@ -65,7 +65,7 @@ describe AutocompleteController do 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) @@ -127,7 +127,7 @@ describe AutocompleteController do 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 @@ -231,8 +231,8 @@ describe AutocompleteController do 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) @@ -289,8 +289,8 @@ describe AutocompleteController do 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) @@ -315,8 +315,8 @@ describe AutocompleteController do 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 566d8515198..05561946e9b 100644 --- a/spec/controllers/dashboard_controller_spec.rb +++ b/spec/controllers/dashboard_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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/projects/merge_requests/conflicts_controller_spec.rb b/spec/controllers/projects/merge_requests/conflicts_controller_spec.rb index 9278ac8edd8..393d38c6e6b 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_spec.rb b/spec/controllers/projects/merge_requests/creations_controller_spec.rb index f9d8f0f5fcf..fc4cec53374 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 @@ describe Projects::MergeRequests::CreationsController do 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 53fe2bdb189..fd6cb3c5dbb 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 @@ describe Projects::MergeRequests::DiffsController do 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_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 0bfe83f1d98..bed2d4f8c98 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 @@ describe Projects::MergeRequestsController do 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) } @@ -429,7 +429,7 @@ describe Projects::MergeRequestsController do 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 @@ -587,7 +587,7 @@ describe Projects::MergeRequestsController do 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/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb index 3b88d5b0d7d..4a6eb76e71f 100644 --- a/spec/controllers/projects/notes_controller_spec.rb +++ b/spec/controllers/projects/notes_controller_spec.rb @@ -167,10 +167,10 @@ describe Projects::NotesController do end context 'when creating a commit comment from an MR fork' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:fork_project) do - create(:project).tap do |fork| + create(:project, :repository).tap do |fork| create(:forked_project_link, forked_to_project: fork, forked_from_project: project) end end diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index c8de275ca3e..ed63e4dec26 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -61,7 +61,7 @@ describe Projects::PipelinesController do 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 cc444f31797..1f082ce7102 100644 --- a/spec/controllers/projects/snippets_controller_spec.rb +++ b/spec/controllers/projects/snippets_controller_spec.rb @@ -156,7 +156,7 @@ describe Projects::SnippetsController do 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 192cca45d99..9f19cc30582 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -196,7 +196,7 @@ describe ProjectsController do 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 @@ -254,7 +254,7 @@ describe ProjectsController do describe '#transfer' do render_views - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:admin) { create(:admin) } let(:new_namespace) { create(:namespace) } @@ -311,8 +311,8 @@ describe ProjectsController do 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, @@ -390,7 +390,7 @@ describe ProjectsController do 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) @@ -408,7 +408,7 @@ describe ProjectsController do 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, @@ -430,7 +430,7 @@ describe ProjectsController do 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 475ceda11fe..a6edcca08f4 100644 --- a/spec/controllers/snippets_controller_spec.rb +++ b/spec/controllers/snippets_controller_spec.rb @@ -273,7 +273,7 @@ describe SnippetsController do 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/factories/uploads.rb b/spec/factories/uploads.rb index 3222c41c3d8..f49dbe6dc9e 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/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index abb9e5eef96..29ac96adc0e 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' 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 fa83ad5d17c..0375d0bf8ff 100644 --- a/spec/features/discussion_comments/commit_spec.rb +++ b/spec/features/discussion_comments/commit_spec.rb @@ -4,7 +4,7 @@ describe 'Discussion Comments Merge Request', :js do 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 042f39f47e0..b0019c32189 100644 --- a/spec/features/discussion_comments/merge_request_spec.rb +++ b/spec/features/discussion_comments/merge_request_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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/issuables/markdown_references_spec.rb b/spec/features/issuables/markdown_references_spec.rb index 169381d703a..04d38165a15 100644 --- a/spec/features/issuables/markdown_references_spec.rb +++ b/spec/features/issuables/markdown_references_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' 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/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 9855cfd85c4..62ac9fd0e95 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' feature 'Editing file blob', js: true do include TreeHelper - let(:project) { create(:project, :public) } + 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/reportable_note/commit_spec.rb b/spec/features/reportable_note/commit_spec.rb index 1074eb62b33..3bf25221e36 100644 --- a/spec/features/reportable_note/commit_spec.rb +++ b/spec/features/reportable_note/commit_spec.rb @@ -4,7 +4,7 @@ describe 'Reportable note on commit', :js do 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 a491abdb6cb..bb296546e06 100644 --- a/spec/features/reportable_note/merge_request_spec.rb +++ b/spec/features/reportable_note/merge_request_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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 300ba8422e8..9fb9ffa95e7 100644 --- a/spec/finders/members_finder_spec.rb +++ b/spec/finders/members_finder_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 7ecb75da8ce..7c6f3b101d7 100644 --- a/spec/helpers/button_helper_spec.rb +++ b/spec/helpers/button_helper_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 e6bb953e9d8..3f8df388014 100644 --- a/spec/helpers/ci_status_helper_spec.rb +++ b/spec/helpers/ci_status_helper_spec.rb @@ -48,7 +48,7 @@ describe CiStatusHelper do 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 060c112e20d..f81a9b6492c 100644 --- a/spec/helpers/diff_helper_spec.rb +++ b/spec/helpers/diff_helper_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 7789cfa3554..1aad8a85ab7 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -180,7 +180,7 @@ describe IssuablesHelper do 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 @@ describe IssuablesHelper do 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 70eb01c9c44..6dfffb7ac63 100644 --- a/spec/helpers/markup_helper_spec.rb +++ b/spec/helpers/markup_helper_spec.rb @@ -42,7 +42,7 @@ describe MarkupHelper do 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 56f252ba273..da1044cef3f 100644 --- a/spec/helpers/notes_helper_spec.rb +++ b/spec/helpers/notes_helper_spec.rb @@ -40,7 +40,7 @@ describe NotesHelper do 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 faf26931efc..c447c061919 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -46,7 +46,7 @@ describe ProjectsHelper do 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 @@ describe ProjectsHelper do 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) @@ -251,7 +251,7 @@ describe ProjectsHelper do 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/javascripts/fixtures/balsamiq.rb b/spec/javascripts/fixtures/balsamiq.rb index b5372821bf5..234e246119a 100644 --- a/spec/javascripts/fixtures/balsamiq.rb +++ b/spec/javascripts/fixtures/balsamiq.rb @@ -4,7 +4,7 @@ describe 'Balsamiq file', '(JavaScript fixtures)', type: :controller do 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 e83db8daaf2..b2114e65d27 100644 --- a/spec/javascripts/fixtures/dashboard.rb +++ b/spec/javascripts/fixtures/dashboard.rb @@ -5,7 +5,7 @@ describe Dashboard::ProjectsController, '(JavaScript fixtures)', type: :controll 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 7e2f364ffa4..f9d8b5c569c 100644 --- a/spec/javascripts/fixtures/merge_requests.rb +++ b/spec/javascripts/fixtures/merge_requests.rb @@ -5,7 +5,7 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont 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 ac5b06ace6d..4481a187f63 100644 --- a/spec/javascripts/fixtures/merge_requests_diffs.rb +++ b/spec/javascripts/fixtures/merge_requests_diffs.rb @@ -6,7 +6,7 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type 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 6b2422a7986..ef9976b9fd3 100644 --- a/spec/javascripts/fixtures/pdf.rb +++ b/spec/javascripts/fixtures/pdf.rb @@ -4,7 +4,7 @@ describe 'PDF file', '(JavaScript fixtures)', type: :controller do 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 6c33b240e5c..b828eee6629 100644 --- a/spec/javascripts/fixtures/projects.rb +++ b/spec/javascripts/fixtures/projects.rb @@ -5,7 +5,7 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do 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 17533443d76..25f5a3b0bb3 100644 --- a/spec/javascripts/fixtures/raw.rb +++ b/spec/javascripts/fixtures/raw.rb @@ -4,7 +4,7 @@ describe 'Raw files', '(JavaScript fixtures)', type: :controller do 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 b9ca68e8935..81f244a4539 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 cb4ae3be525..e76463b5e7c 100644 --- a/spec/lib/container_registry/tag_spec.rb +++ b/spec/lib/container_registry/tag_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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/badge/coverage/report_spec.rb b/spec/lib/gitlab/badge/coverage/report_spec.rb index 1547bd3228c..da789bf3705 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 0daf41a7c86..1fab3b29424 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 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do 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/cycle_analytics/base_event_fetcher_spec.rb b/spec/lib/gitlab/cycle_analytics/base_event_fetcher_spec.rb index d8757c601ab..854aaa34c73 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 @@ require 'spec_helper' 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 a1b3fe8509e..28ea7d4c303 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 df7d1b5d27a..254ce06381e 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca 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 803e923b4a5..95695ca8c16 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : 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 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : 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 0e240a5ccf1..19e23a32bda 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 Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :tr 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 c71568e2a65..8af49ed50ff 100644 --- a/spec/lib/gitlab/diff/parser_spec.rb +++ b/spec/lib/gitlab/diff/parser_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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/email/attachment_uploader_spec.rb b/spec/lib/gitlab/email/attachment_uploader_spec.rb index f61dbc67ad1..89258d2eca7 100644 --- a/spec/lib/gitlab/email/attachment_uploader_spec.rb +++ b/spec/lib/gitlab/email/attachment_uploader_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" 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 bd36d1d309d..6d0e715e889 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 @@ describe Gitlab::Email::Handler::CreateIssueHandler do 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/github_import/importer_spec.rb b/spec/lib/gitlab/github_import/importer_spec.rb index d00a2deaf7b..d570f34985b 100644 --- a/spec/lib/gitlab/github_import/importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer_spec.rb @@ -207,7 +207,7 @@ describe Gitlab::GithubImport::Importer do 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 fcd90fab547..119bf2b5662 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 @@ require 'spec_helper' 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 ac3558ab386..4e09020471b 100644 --- a/spec/lib/gitlab/gl_repository_spec.rb +++ b/spec/lib/gitlab/gl_repository_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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 0ff64cbe880..230cc2d3006 100644 --- a/spec/lib/gitlab/import_export/fork_spec.rb +++ b/spec/lib/gitlab/import_export/fork_spec.rb @@ -2,11 +2,11 @@ require 'spec_helper' describe 'forked project import' do let(:user) { create(:user) } - let!(:project_with_repo) { create(:project, 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 f2b66c4421c..4d87f27ce05 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 @@ require 'spec_helper' describe Gitlab::ImportExport::MergeRequestParser do let(:user) { create(:user) } - let!(:project) { create(:project, 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 82935af2670..d57833c3fec 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 @@ require 'spec_helper' describe Gitlab::ImportExport::RepoRestorer do describe 'bundle a project Git repo' do let(:user) { create(:user) } - let!(:project_with_repo) { create(:project, 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 aeb32ef96d6..c4138c063c8 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 @@ describe Gitlab::IssuableSorter do 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 6af1564da19..de4c8b68ffa 100644 --- a/spec/lib/gitlab/middleware/go_spec.rb +++ b/spec/lib/gitlab/middleware/go_spec.rb @@ -18,7 +18,7 @@ describe Gitlab::Middleware::Go do 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 @@ describe Gitlab::Middleware::Go do 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 d17b436b910..7851beb956b 100644 --- a/spec/lib/gitlab/project_search_results_spec.rb +++ b/spec/lib/gitlab/project_search_results_spec.rb @@ -100,14 +100,14 @@ describe Gitlab::ProjectSearchResults do 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 @@ describe Gitlab::ProjectSearchResults do 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 efea4f429bf..6336f4a7125 100644 --- a/spec/lib/gitlab/repo_path_spec.rb +++ b/spec/lib/gitlab/repo_path_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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 5ebaf6c1507..cd97416bcc9 100644 --- a/spec/lib/gitlab/user_access_spec.rb +++ b/spec/lib/gitlab/user_access_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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 626a6005838..747694cbe33 100644 --- a/spec/migrations/rename_system_namespaces_spec.rb +++ b/spec/migrations/rename_system_namespaces_spec.rb @@ -58,7 +58,7 @@ describe RenameSystemNamespaces, truncate: true do 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 @@ describe RenameSystemNamespaces, truncate: true do 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 @@ describe RenameSystemNamespaces, truncate: true do 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 @@ describe RenameSystemNamespaces, truncate: true do 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 @@ describe RenameSystemNamespaces, truncate: true do 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 @@ describe RenameSystemNamespaces, truncate: true do 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 @@ describe RenameSystemNamespaces, truncate: true do 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 @@ describe RenameSystemNamespaces, truncate: true do 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 82f6f7e5046..35e7e1805d4 100644 --- a/spec/models/blob_viewer/composer_json_spec.rb +++ b/spec/models/blob_viewer/composer_json_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 14cc5f3c0fd..5406ff552f8 100644 --- a/spec/models/blob_viewer/gemspec_spec.rb +++ b/spec/models/blob_viewer/gemspec_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 7a4f9866375..344fcdeb9b6 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 @@ require 'spec_helper' 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 96fb1b08c99..976c2ed3639 100644 --- a/spec/models/blob_viewer/package_json_spec.rb +++ b/spec/models/blob_viewer/package_json_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 f510077a87b..b98360ea7b7 100644 --- a/spec/models/blob_viewer/podspec_json_spec.rb +++ b/spec/models/blob_viewer/podspec_json_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 7c38083550c..ad2bbe034ea 100644 --- a/spec/models/blob_viewer/podspec_spec.rb +++ b/spec/models/blob_viewer/podspec_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 115731b4970..12b6519a344 100644 --- a/spec/models/blob_viewer/route_map_spec.rb +++ b/spec/models/blob_viewer/route_map_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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/participable_spec.rb b/spec/models/concerns/participable_spec.rb index 431f1482615..6c4b5a9e9d6 100644 --- a/spec/models/concerns/participable_spec.rb +++ b/spec/models/concerns/participable_spec.rb @@ -24,7 +24,7 @@ describe Participable do 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 @@ describe Participable do 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 @@ describe Participable do 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 53eaa6f8461..d00faa4f8be 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 36aedd2f701..866a835d62a 100644 --- a/spec/models/concerns/routable_spec.rb +++ b/spec/models/concerns/routable_spec.rb @@ -27,7 +27,7 @@ describe Group, 'Routable' do 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 eff41d85972..bae88cb1d24 100644 --- a/spec/models/container_repository_spec.rb +++ b/spec/models/container_repository_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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 @@ describe ContainerRepository do 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 6447095078b..c5708e70ef9 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -91,7 +91,7 @@ describe Deployment do 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 2704698f6c9..fa02434b0fd 100644 --- a/spec/models/diff_discussion_spec.rb +++ b/spec/models/diff_discussion_spec.rb @@ -5,7 +5,7 @@ describe DiffDiscussion do 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/environment_spec.rb b/spec/models/environment_spec.rb index ebf2c070116..9a35213c98d 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -21,7 +21,7 @@ describe Environment do 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 38fbdd2536a..7dbeb4d2e74 100644 --- a/spec/models/forked_project_link_spec.rb +++ b/spec/models/forked_project_link_spec.rb @@ -41,7 +41,7 @@ describe ForkedProjectLink, "add link on fork" do 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/gpg_signature_spec.rb b/spec/models/gpg_signature_spec.rb index 9a9b1900aa5..c58fd46762a 100644 --- a/spec/models/gpg_signature_spec.rb +++ b/spec/models/gpg_signature_spec.rb @@ -16,7 +16,7 @@ RSpec.describe GpgSignature do describe '#commit' do it 'fetches the commit through the project' do commit_sha = '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' - project = create :project + project = create :project, :repository commit = create :commit, project: project gpg_signature = create :gpg_signature, commit_sha: commit_sha diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index d72790eefe5..eaf06668327 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -724,7 +724,7 @@ describe Issue do 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 d68d8b719cd..0938a7b1b6d 100644 --- a/spec/models/project_group_link_spec.rb +++ b/spec/models/project_group_link_spec.rb @@ -9,7 +9,7 @@ describe ProjectGroupLink do 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_services/chat_notification_service_spec.rb b/spec/models/project_services/chat_notification_service_spec.rb index 413ceed73bf..ae80c4ae002 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 @@ describe ChatNotificationService do 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 e6a1752576b..3ca123cb75d 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 @@ require 'spec_helper' 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/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index bc9374d6dbb..69bb8f1c725 100644 --- a/spec/models/project_services/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -190,7 +190,7 @@ describe JiraService do 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 29cc9d35fc9..3bc6fb09778 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -261,27 +261,27 @@ describe Project do 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 @@ -2045,7 +2045,7 @@ describe Project do end describe '#route_map_for' do - let(:project) { create(:project) } + let(:project) { create(:project, :repository) } let(:route_map) do <<-MAP.strip_heredoc - source: /source/(.*)/ @@ -2082,7 +2082,7 @@ describe Project do 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/(.*)/ @@ -2196,7 +2196,7 @@ describe Project do 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 @@ -2207,7 +2207,7 @@ describe Project do 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 68228a038a8..9ccd366a48e 100644 --- a/spec/models/project_team_spec.rb +++ b/spec/models/project_team_spec.rb @@ -330,7 +330,7 @@ describe ProjectTeam do 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/repository_spec.rb b/spec/models/repository_spec.rb index 0fd3a4d622a..3107037925b 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -300,7 +300,7 @@ describe Repository do 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 diff --git a/spec/models/sent_notification_spec.rb b/spec/models/sent_notification_spec.rb index 8b6b02916ae..8f05deb8b15 100644 --- a/spec/models/sent_notification_spec.rb +++ b/spec/models/sent_notification_spec.rb @@ -21,7 +21,7 @@ describe SentNotification do 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 @@ describe SentNotification do 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 a83a83a7349..11a4c3c742e 100644 --- a/spec/policies/ci/build_policy_spec.rb +++ b/spec/policies/ci/build_policy_spec.rb @@ -97,7 +97,7 @@ describe Ci::BuildPolicy do 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 b11b06d301f..48a8064c5fc 100644 --- a/spec/policies/ci/pipeline_policy_spec.rb +++ b/spec/policies/ci/pipeline_policy_spec.rb @@ -10,7 +10,7 @@ describe Ci::PipelinePolicy, :models do 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 035e20c7452..de4cb5b30c5 100644 --- a/spec/policies/environment_policy_spec.rb +++ b/spec/policies/environment_policy_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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 EnvironmentPolicy do 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 @@ describe EnvironmentPolicy do 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 @@ describe EnvironmentPolicy do 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 c1a0313b13c..0dd4ede5538 100644 --- a/spec/presenters/merge_request_presenter_spec.rb +++ b/spec/presenters/merge_request_presenter_spec.rb @@ -105,7 +105,7 @@ describe MergeRequestPresenter do 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 9e268adf950..55c998b13b8 100644 --- a/spec/requests/api/files_spec.rb +++ b/spec/requests/api/files_spec.rb @@ -80,7 +80,7 @@ describe API::Files do 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 @@ describe API::Files do 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/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index b34555d2815..9ff2b782b52 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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/todos_spec.rb b/spec/requests/api/todos_spec.rb index 9fc73c6e092..f5413913c1e 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(:project) } + 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 153596c2975..d5c53b703dd 100644 --- a/spec/requests/api/triggers_spec.rb +++ b/spec/requests/api/triggers_spec.rb @@ -13,7 +13,7 @@ describe API::Triggers do 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 8b2d165c763..4ffa5d1784e 100644 --- a/spec/requests/api/v3/files_spec.rb +++ b/spec/requests/api/v3/files_spec.rb @@ -74,7 +74,7 @@ describe API::V3::Files do 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 b0eddbb5dd2..e7014458773 100644 --- a/spec/requests/api/v3/project_hooks_spec.rb +++ b/spec/requests/api/v3/project_hooks_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' 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 @@ describe API::ProjectHooks, 'ProjectHooks' do 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/triggers_spec.rb b/spec/requests/api/v3/triggers_spec.rb index 60212660fb6..2a593dd8135 100644 --- a/spec/requests/api/v3/triggers_spec.rb +++ b/spec/requests/api/v3/triggers_spec.rb @@ -10,7 +10,7 @@ describe API::V3::Triggers do 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 4f1a90750b3..ff470a6cad0 100644 --- a/spec/requests/lfs_http_spec.rb +++ b/spec/requests/lfs_http_spec.rb @@ -600,7 +600,7 @@ describe 'Git LFS API and storage' do 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 @@ describe 'Git LFS API and storage' do end describe 'upload' do - let(:project) { create(:project, :public) } + let(:project) { create(:empty_project, :public) } let(:body) do { 'operation' => 'upload', @@ -1019,7 +1019,7 @@ describe 'Git LFS API and storage' do 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/request_profiler_spec.rb b/spec/requests/request_profiler_spec.rb index 9afeb2983b0..1325ba37fd8 100644 --- a/spec/requests/request_profiler_spec.rb +++ b/spec/requests/request_profiler_spec.rb @@ -13,7 +13,7 @@ describe 'Request Profiler' do 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/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 4ec495f612e..730df4e0336 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -75,7 +75,7 @@ describe Ci::CreatePipelineService do 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 1ced26ff98d..04f926ccb32 100644 --- a/spec/services/ci/play_build_service_spec.rb +++ b/spec/services/ci/play_build_service_spec.rb @@ -33,7 +33,7 @@ describe Ci::PlayBuildService, '#execute' do 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/labels/create_service_spec.rb b/spec/services/labels/create_service_spec.rb index ecb88653001..9ff3a5375b9 100644 --- a/spec/services/labels/create_service_spec.rb +++ b/spec/services/labels/create_service_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' 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 bb95fe20fbf..f0bec7e9f9c 100644 --- a/spec/services/labels/update_service_spec.rb +++ b/spec/services/labels/update_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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/milestones/destroy_service_spec.rb b/spec/services/milestones/destroy_service_spec.rb index 5739386dd0d..f7a6c3d323e 100644 --- a/spec/services/milestones/destroy_service_spec.rb +++ b/spec/services/milestones/destroy_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' 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/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb index 786335120fd..db30fe2c24e 100644 --- a/spec/services/users/destroy_service_spec.rb +++ b/spec/services/users/destroy_service_spec.rb @@ -40,7 +40,7 @@ describe Users::DestroyService do 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 @@ describe Users::DestroyService do 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 a0030ce8809..ac3a8738cac 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 @@ require 'spec_helper' 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 035428a7d9b..47a7fd0c2ea 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 @@ shared_examples 'issuable record that supports quick actions in its description 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 57b6abe12b7..2011408be93 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 855051921f0..bbb63a08374 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 @@ require "spec_helper" 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 47e9365e13d..c2510a10286 100644 --- a/spec/uploaders/file_uploader_spec.rb +++ b/spec/uploaders/file_uploader_spec.rb @@ -5,7 +5,7 @@ describe FileUploader do 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 8bd5306ff98..dd90a836a78 100644 --- a/spec/validators/dynamic_path_validator_spec.rb +++ b/spec/validators/dynamic_path_validator_spec.rb @@ -28,7 +28,7 @@ describe DynamicPathValidator do 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 fd1637ca91b..faea2505e40 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 @@ describe 'layouts/nav/_project' do 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 f627f9165fb..d9d73f789c5 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 @@ describe 'notify/pipeline_failed_email.html.haml' do 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 ecd096ee579..a793b37e412 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 @@ describe 'notify/pipeline_success_email.html.haml' do 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/create_gpg_signature_worker_spec.rb b/spec/workers/create_gpg_signature_worker_spec.rb index c6a17d77d73..62ec011a3fe 100644 --- a/spec/workers/create_gpg_signature_worker_spec.rb +++ b/spec/workers/create_gpg_signature_worker_spec.rb @@ -4,7 +4,7 @@ describe CreateGpgSignatureWorker do context 'when GpgKey is found' do it 'calls Commit#signature' do commit_sha = '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' - project = create :project + project = create :empty_project commit = instance_double(Commit) allow(Project).to receive(:find_by).with(id: project.id).and_return(project) @@ -18,7 +18,7 @@ describe CreateGpgSignatureWorker do context 'when Commit is not found' do let(:nonexisting_commit_sha) { 'bogus' } - let(:project) { create :project } + let(:project) { create :empty_project } it 'does not raise errors' do expect { described_class.new.perform(nonexisting_commit_sha, project.id) }.not_to raise_error diff --git a/spec/workers/process_commit_worker_spec.rb b/spec/workers/process_commit_worker_spec.rb index 6ebc94bb544..24f8ca67594 100644 --- a/spec/workers/process_commit_worker_spec.rb +++ b/spec/workers/process_commit_worker_spec.rb @@ -33,7 +33,7 @@ describe ProcessCommitWorker do 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) |