Commit 9513bd18 authored by Robert Speicher's avatar Robert Speicher

Ensure all project factories use `:repository` trait or `:empty_project`

parent 4c77c30f
...@@ -4,7 +4,7 @@ describe Admin::ApplicationSettingsController do ...@@ -4,7 +4,7 @@ describe Admin::ApplicationSettingsController do
include StubENV include StubENV
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) } let(:project) { create(:empty_project, namespace: group) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:user) { create(:user)} let(:user) { create(:user)}
......
...@@ -8,8 +8,8 @@ describe Admin::DashboardController do ...@@ -8,8 +8,8 @@ describe Admin::DashboardController do
it 'does not retrieve projects that are pending deletion' do it 'does not retrieve projects that are pending deletion' do
sign_in(create(:admin)) sign_in(create(:admin))
project = create(:project) project = create(:empty_project)
pending_delete_project = create(:project, pending_delete: true) pending_delete_project = create(:empty_project, pending_delete: true)
get :index get :index
......
...@@ -65,7 +65,7 @@ describe AutocompleteController do ...@@ -65,7 +65,7 @@ describe AutocompleteController do
end end
context 'non-member login for public project' do context 'non-member login for public project' do
let!(:project) { create(:project, :public) } let!(:project) { create(:empty_project, :public) }
before do before do
sign_in(non_member) sign_in(non_member)
...@@ -127,7 +127,7 @@ describe AutocompleteController do ...@@ -127,7 +127,7 @@ describe AutocompleteController do
end end
context 'unauthenticated user' do context 'unauthenticated user' do
let(:public_project) { create(:project, :public) } let(:public_project) { create(:empty_project, :public) }
let(:body) { JSON.parse(response.body) } let(:body) { JSON.parse(response.body) }
describe 'GET #users with public project' do describe 'GET #users with public project' do
...@@ -231,8 +231,8 @@ describe AutocompleteController do ...@@ -231,8 +231,8 @@ describe AutocompleteController do
end end
context 'GET projects' do context 'GET projects' do
let(:authorized_project) { create(:project) } let(:authorized_project) { create(:empty_project) }
let(:authorized_search_project) { create(:project, name: 'rugged') } let(:authorized_search_project) { create(:empty_project, name: 'rugged') }
before do before do
sign_in(user) sign_in(user)
...@@ -289,8 +289,8 @@ describe AutocompleteController do ...@@ -289,8 +289,8 @@ describe AutocompleteController do
context 'authorized projects apply limit' do context 'authorized projects apply limit' do
before do before do
authorized_project2 = create(:project) authorized_project2 = create(:empty_project)
authorized_project3 = create(:project) authorized_project3 = create(:empty_project)
authorized_project.add_master(user) authorized_project.add_master(user)
authorized_project2.add_master(user) authorized_project2.add_master(user)
...@@ -315,8 +315,8 @@ describe AutocompleteController do ...@@ -315,8 +315,8 @@ describe AutocompleteController do
context 'authorized projects with offset' do context 'authorized projects with offset' do
before do before do
authorized_project2 = create(:project) authorized_project2 = create(:empty_project)
authorized_project3 = create(:project) authorized_project3 = create(:empty_project)
authorized_project.add_master(user) authorized_project.add_master(user)
authorized_project2.add_master(user) authorized_project2.add_master(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe DashboardController do describe DashboardController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
before do before do
project.team << [user, :master] project.team << [user, :master]
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequests::ConflictsController do describe Projects::MergeRequests::ConflictsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:merge_request_with_conflicts) do let(:merge_request_with_conflicts) do
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequests::CreationsController do describe Projects::MergeRequests::CreationsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
let(:fork_project) { create(:forked_project_with_submodules) } let(:fork_project) { create(:forked_project_with_submodules) }
...@@ -83,7 +83,7 @@ describe Projects::MergeRequests::CreationsController do ...@@ -83,7 +83,7 @@ describe Projects::MergeRequests::CreationsController do
end end
context 'when the source branch is in a different project to the target' do context 'when the source branch is in a different project to the target' do
let(:other_project) { create(:project) } let(:other_project) { create(:project, :repository) }
before do before do
other_project.team << [user, :master] other_project.team << [user, :master]
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequests::DiffsController do describe Projects::MergeRequests::DiffsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
...@@ -36,7 +36,7 @@ describe Projects::MergeRequests::DiffsController do ...@@ -36,7 +36,7 @@ describe Projects::MergeRequests::DiffsController do
context 'with forked projects with submodules' do context 'with forked projects with submodules' do
render_views render_views
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:fork_project) { create(:forked_project_with_submodules) } let(:fork_project) { create(:forked_project_with_submodules) }
let(:merge_request) { create(:merge_request_with_diffs, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) } let(:merge_request) { create(:merge_request_with_diffs, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequestsController do describe Projects::MergeRequestsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:merge_request_with_conflicts) do let(:merge_request_with_conflicts) do
...@@ -191,7 +191,7 @@ describe Projects::MergeRequestsController do ...@@ -191,7 +191,7 @@ describe Projects::MergeRequestsController do
end end
context 'there is no source project' do context 'there is no source project' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:fork_project) { create(:forked_project_with_submodules) } let(:fork_project) { create(:forked_project_with_submodules) }
let(:merge_request) { create(:merge_request, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) } let(:merge_request) { create(:merge_request, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) }
...@@ -429,7 +429,7 @@ describe Projects::MergeRequestsController do ...@@ -429,7 +429,7 @@ describe Projects::MergeRequestsController do
context "when the user is owner" do context "when the user is owner" do
let(:owner) { create(:user) } let(:owner) { create(:user) }
let(:namespace) { create(:namespace, owner: owner) } let(:namespace) { create(:namespace, owner: owner) }
let(:project) { create(:project, namespace: namespace) } let(:project) { create(:project, :repository, namespace: namespace) }
before do before do
sign_in owner sign_in owner
...@@ -587,7 +587,7 @@ describe Projects::MergeRequestsController do ...@@ -587,7 +587,7 @@ describe Projects::MergeRequestsController do
describe 'GET ci_environments_status' do describe 'GET ci_environments_status' do
context 'the environment is from a forked project' do context 'the environment is from a forked project' do
let!(:forked) { create(:project) } let!(:forked) { create(:project, :repository) }
let!(:environment) { create(:environment, project: forked) } let!(:environment) { create(:environment, project: forked) }
let!(:deployment) { create(:deployment, environment: environment, sha: forked.commit.id, ref: 'master') } let!(:deployment) { create(:deployment, environment: environment, sha: forked.commit.id, ref: 'master') }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
......
...@@ -167,10 +167,10 @@ describe Projects::NotesController do ...@@ -167,10 +167,10 @@ describe Projects::NotesController do
end end
context 'when creating a commit comment from an MR fork' do context 'when creating a commit comment from an MR fork' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:fork_project) do 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) create(:forked_project_link, forked_to_project: fork, forked_from_project: project)
end end
end end
......
...@@ -61,7 +61,7 @@ describe Projects::PipelinesController do ...@@ -61,7 +61,7 @@ describe Projects::PipelinesController do
create_build('post deploy', 3, 'pages 0') create_build('post deploy', 3, 'pages 0')
end end
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:pipeline) do let(:pipeline) do
create(:ci_empty_pipeline, project: project, user: user, sha: project.commit.id) create(:ci_empty_pipeline, project: project, user: user, sha: project.commit.id)
end end
......
...@@ -156,7 +156,7 @@ describe Projects::SnippetsController do ...@@ -156,7 +156,7 @@ describe Projects::SnippetsController do
end end
describe 'PUT #update' do describe 'PUT #update' do
let(:project) { create :project, :public } let(:project) { create :empty_project, :public }
let(:snippet) { create :project_snippet, author: user, project: project, visibility_level: visibility_level } let(:snippet) { create :project_snippet, author: user, project: project, visibility_level: visibility_level }
def update_snippet(snippet_params = {}, additional_params = {}) def update_snippet(snippet_params = {}, additional_params = {})
......
...@@ -196,7 +196,7 @@ describe ProjectsController do ...@@ -196,7 +196,7 @@ describe ProjectsController do
context "redirection from http://someproject.git" do context "redirection from http://someproject.git" do
it 'redirects to project page (format.html)' do it 'redirects to project page (format.html)' do
project = create(:project, :public) project = create(:empty_project, :public)
get :show, namespace_id: project.namespace, id: project, format: :git get :show, namespace_id: project.namespace, id: project, format: :git
...@@ -254,7 +254,7 @@ describe ProjectsController do ...@@ -254,7 +254,7 @@ describe ProjectsController do
describe '#transfer' do describe '#transfer' do
render_views render_views
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:new_namespace) { create(:namespace) } let(:new_namespace) { create(:namespace) }
...@@ -311,8 +311,8 @@ describe ProjectsController do ...@@ -311,8 +311,8 @@ describe ProjectsController do
end end
context "when the project is forked" do context "when the project is forked" do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:fork_project) { create(:project, forked_from_project: project) } let(:fork_project) { create(:project, :repository, forked_from_project: project) }
let(:merge_request) do let(:merge_request) do
create(:merge_request, create(:merge_request,
source_project: fork_project, source_project: fork_project,
...@@ -390,7 +390,7 @@ describe ProjectsController do ...@@ -390,7 +390,7 @@ describe ProjectsController do
end end
context 'with forked project' do context 'with forked project' do
let(:project_fork) { create(:project, namespace: user.namespace) } let(:project_fork) { create(:project, :repository, namespace: user.namespace) }
before do before do
create(:forked_project_link, forked_to_project: project_fork) create(:forked_project_link, forked_to_project: project_fork)
...@@ -408,7 +408,7 @@ describe ProjectsController do ...@@ -408,7 +408,7 @@ describe ProjectsController do
end end
context 'when project not forked' do context 'when project not forked' do
let(:unforked_project) { create(:project, namespace: user.namespace) } let(:unforked_project) { create(:empty_project, namespace: user.namespace) }
it 'does nothing if project was not forked' do it 'does nothing if project was not forked' do
delete(:remove_fork, delete(:remove_fork,
...@@ -430,7 +430,7 @@ describe ProjectsController do ...@@ -430,7 +430,7 @@ describe ProjectsController do
end end
describe "GET refs" do describe "GET refs" do
let(:public_project) { create(:project, :public) } let(:public_project) { create(:project, :public, :repository) }
it "gets a list of branches and tags" do it "gets a list of branches and tags" do
get :refs, namespace_id: public_project.namespace, id: public_project get :refs, namespace_id: public_project.namespace, id: public_project
......
...@@ -273,7 +273,7 @@ describe SnippetsController do ...@@ -273,7 +273,7 @@ describe SnippetsController do
end end
describe 'PUT #update' do describe 'PUT #update' do
let(:project) { create :project } let(:project) { create :empty_project }
let(:snippet) { create :personal_snippet, author: user, project: project, visibility_level: visibility_level } let(:snippet) { create :personal_snippet, author: user, project: project, visibility_level: visibility_level }
def update_snippet(snippet_params = {}, additional_params = {}) def update_snippet(snippet_params = {}, additional_params = {})
......
FactoryGirl.define do FactoryGirl.define do
factory :upload do factory :upload do
model { build(:project) } model { build(:empty_project) }
path { "uploads/-/system/project/avatar/avatar.jpg" } path { "uploads/-/system/project/avatar/avatar.jpg" }
size 100.kilobytes size 100.kilobytes
uploader "AvatarUploader" uploader "AvatarUploader"
......
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
feature 'Dashboard Projects' do feature 'Dashboard Projects' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, name: 'awesome stuff') } let(:project) { create(:project, :repository, name: 'awesome stuff') }
let(:project2) { create(:project, :public, name: 'Community project') } let(:project2) { create(:empty_project, :public, name: 'Community project') }
before do before do
project.team << [user, :developer] project.team << [user, :developer]
......
...@@ -4,7 +4,7 @@ describe 'Discussion Comments Merge Request', :js do ...@@ -4,7 +4,7 @@ describe 'Discussion Comments Merge Request', :js do
include RepoHelpers include RepoHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Discussion Comments Merge Request', :js do describe 'Discussion Comments Merge Request', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
describe 'Markdown References', :js do describe 'Markdown References', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:actual_project) { create(:project, :public) } let(:actual_project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, target_project: actual_project, source_project: actual_project)} let(:merge_request) { create(:merge_request, target_project: actual_project, source_project: actual_project)}
let(:issue_actual_project) { create(:issue, project: actual_project) } let(:issue_actual_project) { create(:issue, project: actual_project) }
let!(:other_project) { create(:empty_project, :public) } let!(:other_project) { create(:empty_project, :public) }
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
feature 'Editing file blob', js: true do feature 'Editing file blob', js: true do
include TreeHelper include TreeHelper
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'master') } let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'master') }
let(:branch) { 'master' } let(:branch) { 'master' }
let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] } let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] }
......
...@@ -4,7 +4,7 @@ describe 'Reportable note on commit', :js do ...@@ -4,7 +4,7 @@ describe 'Reportable note on commit', :js do
include RepoHelpers include RepoHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
project.add_master(user) project.add_master(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Reportable note on merge request', :js do describe 'Reportable note on merge request', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe MembersFinder, '#execute' do describe MembersFinder, '#execute' do
let(:group) { create(:group) } let(:group) { create(:group) }
let(:nested_group) { create(:group, :access_requestable, parent: group) } let(:nested_group) { create(:group, :access_requestable, parent: group) }
let(:project) { create(:project, namespace: nested_group) } let(:project) { create(:empty_project, namespace: nested_group) }
let(:user1) { create(:user) } let(:user1) { create(:user) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:user3) { create(:user) } let(:user3) { create(:user) }
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe ButtonHelper do describe ButtonHelper do
describe 'http_clone_button' do describe 'http_clone_button' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { build_stubbed(:empty_project) }
let(:has_tooltip_class) { 'has-tooltip' } let(:has_tooltip_class) { 'has-tooltip' }
def element def element
......
...@@ -48,7 +48,7 @@ describe CiStatusHelper do ...@@ -48,7 +48,7 @@ describe CiStatusHelper do
describe "#pipeline_status_cache_key" do describe "#pipeline_status_cache_key" do
it "builds a cache key for pipeline status" do it "builds a cache key for pipeline status" do
pipeline_status = Gitlab::Cache::Ci::ProjectPipelineStatus.new( pipeline_status = Gitlab::Cache::Ci::ProjectPipelineStatus.new(
build(:project), build_stubbed(:empty_project),
pipeline_info: { pipeline_info: {
sha: "123abc", sha: "123abc",
status: "success" status: "success"
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe DiffHelper do describe DiffHelper do
include RepoHelpers include RepoHelpers
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:repository) { project.repository } let(:repository) { project.repository }
let(:commit) { project.commit(sample_commit.id) } let(:commit) { project.commit(sample_commit.id) }
let(:diffs) { commit.raw_diffs } let(:diffs) { commit.raw_diffs }
......
...@@ -180,7 +180,7 @@ describe IssuablesHelper do ...@@ -180,7 +180,7 @@ describe IssuablesHelper do
context 'when show_full_reference falsey' do context 'when show_full_reference falsey' do
context 'when @group present' do context 'when @group present' do
it 'display issuable reference to @group' do it 'display issuable reference to @group' do
project = build_stubbed(:project) project = build_stubbed(:empty_project)
assign(:show_full_reference, nil) assign(:show_full_reference, nil)
assign(:group, project.namespace) assign(:group, project.namespace)
...@@ -193,7 +193,7 @@ describe IssuablesHelper do ...@@ -193,7 +193,7 @@ describe IssuablesHelper do
context 'when @project present' do context 'when @project present' do
it 'display issuable reference to @project' do it 'display issuable reference to @project' do
project = build_stubbed(:project) project = build_stubbed(:empty_project)
assign(:show_full_reference, nil) assign(:show_full_reference, nil)
assign(:group, nil) assign(:group, nil)
......
...@@ -42,7 +42,7 @@ describe MarkupHelper do ...@@ -42,7 +42,7 @@ describe MarkupHelper do
describe "override default project" do describe "override default project" do
let(:actual) { issue.to_reference } let(:actual) { issue.to_reference }
let(:second_project) { create(:project, :public) } let(:second_project) { create(:empty_project, :public) }
let(:second_issue) { create(:issue, project: second_project) } let(:second_issue) { create(:issue, project: second_project) }
it 'links to the issue' do it 'links to the issue' do
......
...@@ -40,7 +40,7 @@ describe NotesHelper do ...@@ -40,7 +40,7 @@ describe NotesHelper do
end end
describe '#discussion_path' do describe '#discussion_path' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
context 'for a merge request discusion' do context 'for a merge request discusion' do
let(:merge_request) { create(:merge_request, source_project: project, target_project: project, importing: true) } let(:merge_request) { create(:merge_request, source_project: project, target_project: project, importing: true) }
......
...@@ -46,7 +46,7 @@ describe ProjectsHelper do ...@@ -46,7 +46,7 @@ describe ProjectsHelper do
end end
describe "readme_cache_key" do describe "readme_cache_key" do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
helper.instance_variable_set(:@project, project) helper.instance_variable_set(:@project, project)
...@@ -64,7 +64,7 @@ describe ProjectsHelper do ...@@ -64,7 +64,7 @@ describe ProjectsHelper do
end end
describe "#project_list_cache_key", clean_gitlab_redis_shared_state: true do describe "#project_list_cache_key", clean_gitlab_redis_shared_state: true do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
it "includes the route" do it "includes the route" do
expect(helper.project_list_cache_key(project)).to include(project.route.cache_key) expect(helper.project_list_cache_key(project)).to include(project.route.cache_key)
...@@ -251,7 +251,7 @@ describe ProjectsHelper do ...@@ -251,7 +251,7 @@ describe ProjectsHelper do
end end
describe '#sanitized_import_error' do describe '#sanitized_import_error' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
allow(project).to receive(:repository_storage_path).and_return('/base/repo/path') allow(project).to receive(:repository_storage_path).and_return('/base/repo/path')
......
...@@ -4,7 +4,7 @@ describe 'Balsamiq file', '(JavaScript fixtures)', type: :controller do ...@@ -4,7 +4,7 @@ describe 'Balsamiq file', '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers include JavaScriptFixturesHelpers
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'balsamiq-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'balsamiq-project') }
before(:all) do before(:all) do
clean_frontend_fixtures('blob/balsamiq/') clean_frontend_fixtures('blob/balsamiq/')
......
...@@ -5,7 +5,7 @@ describe Dashboard::ProjectsController, '(JavaScript fixtures)', type: :controll ...@@ -5,7 +5,7 @@ describe Dashboard::ProjectsController, '(JavaScript fixtures)', type: :controll
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'builds-project') } let(:project) { create(:empty_project, namespace: namespace, path: 'builds-project') }
render_views render_views
......
...@@ -5,7 +5,7 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont ...@@ -5,7 +5,7 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'merge-requests-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') }
let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') } let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') }
let(:merged_merge_request) { create(:merge_request, :merged, source_project: project, target_project: project) } let(:merged_merge_request) { create(:merge_request, :merged, source_project: project, target_project: project) }
let(:pipeline) do let(:pipeline) do
......
...@@ -6,7 +6,7 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type ...@@ -6,7 +6,7 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'merge-requests-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') }
let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') } let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') }
let(:path) { "files/ruby/popen.rb" } let(:path) { "files/ruby/popen.rb" }
let(:position) do let(:position) do
......
...@@ -4,7 +4,7 @@ describe 'PDF file', '(JavaScript fixtures)', type: :controller do ...@@ -4,7 +4,7 @@ describe 'PDF file', '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers include JavaScriptFixturesHelpers
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'pdf-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'pdf-project') }
before(:all) do before(:all) do
clean_frontend_fixtures('blob/pdf/') clean_frontend_fixtures('blob/pdf/')
......
...@@ -5,7 +5,7 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do ...@@ -5,7 +5,7 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'builds-project') } let(:project) { create(:empty_project, namespace: namespace, path: 'builds-project') }
render_views render_views
......
...@@ -4,7 +4,7 @@ describe 'Raw files', '(JavaScript fixtures)', type: :controller do ...@@ -4,7 +4,7 @@ describe 'Raw files', '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers include JavaScriptFixturesHelpers
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, namespace: namespace, path: 'raw-project') } let(:project) { create(:project, :repository, namespace: namespace, path: 'raw-project') }
before(:all) do before(:all) do
clean_frontend_fixtures('blob/notebook/') clean_frontend_fixtures('blob/notebook/')
......
require 'spec_helper' require 'spec_helper'
describe Banzai::Filter::ReferenceFilter do describe Banzai::Filter::ReferenceFilter do
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
describe '#each_node' do describe '#each_node' do
it 'iterates over the nodes in a document' do it 'iterates over the nodes in a document' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe ContainerRegistry::Tag do describe ContainerRegistry::Tag do
let(:group) { create(:group, name: 'group') } let(:group) { create(:group, name: 'group') }
let(:project) { create(:project, path: 'test', group: group) } let(:project) { create(:project, :repository, path: 'test', group: group) }
let(:repository) do let(:repository) do
create(:container_repository, name: '', project: project) create(:container_repository, name: '', project: project)
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Badge::Coverage::Report do describe Gitlab::Badge::Coverage::Report do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:job_name) { nil } let(:job_name) { nil }
let(:badge) do let(:badge) do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do
let!(:project) { create(:project) } let!(:project) { create(:project, :repository) }
let(:pipeline_status) { described_class.new(project) } let(:pipeline_status) { described_class.new(project) }
let(:cache_key) { "projects/#{project.id}/pipeline_status" } let(:cache_key) { "projects/#{project.id}/pipeline_status" }
...@@ -18,7 +18,7 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do ...@@ -18,7 +18,7 @@ describe Gitlab::Cache::Ci::ProjectPipelineStatus, :clean_gitlab_redis_cache do
let(:sha) { '424d1b73bc0d3cb726eb7dc4ce17a4d48552f8c6' } let(:sha) { '424d1b73bc0d3cb726eb7dc4ce17a4d48552f8c6' }
let(:ref) { 'master' } let(:ref) { 'master' }
let(:pipeline_info) { { sha: sha, status: status, ref: ref } } let(:pipeline_info) { { sha: sha, status: status, ref: ref } }
let!(:project_without_status) { create(:project) } let!(:project_without_status) { create(:project, :repository) }
describe '.load_in_batch_for_projects' do describe '.load_in_batch_for_projects' do
it 'preloads pipeline_status on projects' do it 'preloads pipeline_status on projects' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::CycleAnalytics::BaseEventFetcher do describe Gitlab::CycleAnalytics::BaseEventFetcher do
let(:max_events) { 2 } let(:max_events) { 2 }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user, :admin) } let(:user) { create(:user, :admin) }
let(:start_time_attrs) { Issue.arel_table[:created_at] } let(:start_time_attrs) { Issue.arel_table[:created_at] }
let(:end_time_attrs) { [Issue::Metrics.arel_table[:first_associated_with_milestone_at]] } let(:end_time_attrs) { [Issue::Metrics.arel_table[:first_associated_with_milestone_at]] }
......
require 'spec_helper' require 'spec_helper'
describe 'cycle analytics events' do describe 'cycle analytics events' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:from_date) { 10.days.ago } let(:from_date) { 10.days.ago }
let(:user) { create(:user, :admin) } let(:user) { create(:user, :admin) }
let!(:context) { create(:issue, project: project, created_at: 2.days.ago) } let!(:context) { create(:issue, project: project, created_at: 2.days.ago) }
......
...@@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca ...@@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca
end end
it "renames the route for projects of the namespace" do it "renames the route for projects of the namespace" do
project = create(:project, path: "project-path", namespace: namespace) project = create(:project, :repository, path: "project-path", namespace: namespace)
subject.rename_path_for_routable(migration_namespace(namespace)) subject.rename_path_for_routable(migration_namespace(namespace))
...@@ -120,7 +120,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca ...@@ -120,7 +120,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca
context "the-path namespace -> subgroup -> the-path0 project" do context "the-path namespace -> subgroup -> the-path0 project" do
it "updates the route of the project correctly" do it "updates the route of the project correctly" do
subgroup = create(:group, path: "subgroup", parent: namespace) subgroup = create(:group, path: "subgroup", parent: namespace)
project = create(:project, path: "the-path0", namespace: subgroup) project = create(:project, :repository, path: "the-path0", namespace: subgroup)
subject.rename_path_for_routable(migration_namespace(namespace)) subject.rename_path_for_routable(migration_namespace(namespace))
...@@ -165,7 +165,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca ...@@ -165,7 +165,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameBase, :trunca
it 'renames all the routes for the namespace' do it 'renames all the routes for the namespace' do
child = create(:group, path: 'child', parent: namespace) child = create(:group, path: 'child', parent: namespace)
project = create(:project, namespace: child, path: 'the-project') project = create(:project, :repository, namespace: child, path: 'the-project')
other_one = create(:namespace, path: 'the-path-is-similar') other_one = create(:namespace, path: 'the-path-is-similar')
subject.perform_rename(migration_namespace(namespace), 'the-path', 'renamed') subject.perform_rename(migration_namespace(namespace), 'the-path', 'renamed')
......
...@@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -94,7 +94,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
describe '#move_repositories' do describe '#move_repositories' do
let(:namespace) { create(:group, name: 'hello-group') } let(:namespace) { create(:group, name: 'hello-group') }
it 'moves a project for a namespace' do it 'moves a project for a namespace' do
create(:project, namespace: namespace, path: 'hello-project') create(:project, :repository, namespace: namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'bye-group', 'hello-project.git') expected_path = File.join(TestEnv.repos_path, 'bye-group', 'hello-project.git')
subject.move_repositories(namespace, 'hello-group', 'bye-group') subject.move_repositories(namespace, 'hello-group', 'bye-group')
...@@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
it 'moves a namespace in a subdirectory correctly' do it 'moves a namespace in a subdirectory correctly' do
child_namespace = create(:group, name: 'sub-group', parent: namespace) child_namespace = create(:group, name: 'sub-group', parent: namespace)
create(:project, namespace: child_namespace, path: 'hello-project') create(:project, :repository, namespace: child_namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'hello-group', 'renamed-sub-group', 'hello-project.git') expected_path = File.join(TestEnv.repos_path, 'hello-group', 'renamed-sub-group', 'hello-project.git')
...@@ -115,7 +115,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -115,7 +115,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
it 'moves a parent namespace with subdirectories' do it 'moves a parent namespace with subdirectories' do
child_namespace = create(:group, name: 'sub-group', parent: namespace) child_namespace = create(:group, name: 'sub-group', parent: namespace)
create(:project, namespace: child_namespace, path: 'hello-project') create(:project, :repository, namespace: child_namespace, path: 'hello-project')
expected_path = File.join(TestEnv.repos_path, 'renamed-group', 'sub-group', 'hello-project.git') expected_path = File.join(TestEnv.repos_path, 'renamed-group', 'sub-group', 'hello-project.git')
subject.move_repositories(child_namespace, 'hello-group', 'renamed-group') subject.move_repositories(child_namespace, 'hello-group', 'renamed-group')
...@@ -166,7 +166,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -166,7 +166,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
describe '#rename_namespace_dependencies' do describe '#rename_namespace_dependencies' do
it "moves the the repository for a project in the namespace" do it "moves the the repository for a project in the namespace" do
create(:project, namespace: namespace, path: "the-path-project") create(:project, :repository, namespace: namespace, path: "the-path-project")
expected_repo = File.join(TestEnv.repos_path, "the-path0", "the-path-project.git") expected_repo = File.join(TestEnv.repos_path, "the-path0", "the-path-project.git")
subject.rename_namespace_dependencies(namespace, 'the-path', 'the-path0') subject.rename_namespace_dependencies(namespace, 'the-path', 'the-path0')
...@@ -243,7 +243,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -243,7 +243,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
describe '#revert_renames', redis: true do describe '#revert_renames', redis: true do
it 'renames the routes back to the previous values' do it 'renames the routes back to the previous values' do
project = create(:project, path: 'a-project', namespace: namespace) project = create(:project, :repository, path: 'a-project', namespace: namespace)
subject.rename_namespace(namespace) subject.rename_namespace(namespace)
expect(subject).to receive(:perform_rename) expect(subject).to receive(:perform_rename)
...@@ -261,7 +261,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, : ...@@ -261,7 +261,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameNamespaces, :
end end
it 'moves the repositories back to their original place' do it 'moves the repositories back to their original place' do
project = create(:project, path: 'a-project', namespace: namespace) project = create(:project, :repository, path: 'a-project', namespace: namespace)
project.create_repository project.create_repository
subject.rename_namespace(namespace) subject.rename_namespace(namespace)
......
...@@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :tr ...@@ -104,7 +104,7 @@ describe Gitlab::Database::RenameReservedPathsMigration::V1::RenameProjects, :tr
describe '#move_repository' do describe '#move_repository' do
let(:known_parent) { create(:namespace, path: 'known-parent') } let(:known_parent) { create(:namespace, path: 'known-parent') }
let(:project) { create(:project, path: 'the-path', namespace: known_parent) } let(:project) { create(:project, :repository, path: 'the-path', namespace: known_parent) }
it 'moves the repository for a project' do it 'moves the repository for a project' do
expected_path = File.join(TestEnv.repos_path, 'known-parent', 'new-repo.git') expected_path = File.join(TestEnv.repos_path, 'known-parent', 'new-repo.git')
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::Diff::Parser do describe Gitlab::Diff::Parser do
include RepoHelpers include RepoHelpers
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:commit) { project.commit(sample_commit.id) } let(:commit) { project.commit(sample_commit.id) }
let(:diff) { commit.raw_diffs.first } let(:diff) { commit.raw_diffs.first }
let(:parser) { described_class.new } let(:parser) { described_class.new }
......
...@@ -2,7 +2,7 @@ require "spec_helper" ...@@ -2,7 +2,7 @@ require "spec_helper"
describe Gitlab::Email::AttachmentUploader do describe Gitlab::Email::AttachmentUploader do
describe "#execute" do describe "#execute" do
let(:project) { build(:project) } let(:project) { build(:empty_project) }
let(:message_raw) { fixture_file("emails/attachment.eml") } let(:message_raw) { fixture_file("emails/attachment.eml") }
let(:message) { Mail::Message.new(message_raw) } let(:message) { Mail::Message.new(message_raw) }
......
...@@ -69,7 +69,7 @@ describe Gitlab::Email::Handler::CreateIssueHandler do ...@@ -69,7 +69,7 @@ describe Gitlab::Email::Handler::CreateIssueHandler do
end end
context "when project is private" do context "when project is private" do
let(:project) { create(:project, :private, namespace: namespace) } let(:project) { create(:empty_project, :private, namespace: namespace) }
it "raises a ProjectNotFound if the user is not a member" do it "raises a ProjectNotFound if the user is not a member" do
expect { receiver.execute }.to raise_error(Gitlab::Email::ProjectNotFound) expect { receiver.execute }.to raise_error(Gitlab::Email::ProjectNotFound)
......
...@@ -207,7 +207,7 @@ describe Gitlab::GithubImport::Importer do ...@@ -207,7 +207,7 @@ describe Gitlab::GithubImport::Importer do
end end
end end
let(:project) { create(:project, :wiki_disabled, import_url: "#{repo_root}/octocat/Hello-World.git") } let(:project) { create(:project, :repository, :wiki_disabled, import_url: "#{repo_root}/octocat/Hello-World.git") }
let(:octocat) { double(id: 123456, login: 'octocat', email: 'octocat@example.com') } let(:octocat) { double(id: 123456, login: 'octocat', email: 'octocat@example.com') }
let(:credentials) { { user: 'joe' } } let(:credentials) { { user: 'joe' } }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::GithubImport::WikiFormatter do describe Gitlab::GithubImport::WikiFormatter do
let(:project) do let(:project) do
create(:project, create(:empty_project,
namespace: create(:namespace, path: 'gitlabhq'), namespace: create(:namespace, path: 'gitlabhq'),
import_url: 'https://xxx@github.com/gitlabhq/sample.gitlabhq.git') import_url: 'https://xxx@github.com/gitlabhq/sample.gitlabhq.git')
end end
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe ::Gitlab::GlRepository do describe ::Gitlab::GlRepository do
describe '.parse' do describe '.parse' do
set(:project) { create(:project) } set(:project) { create(:project, :repository) }
it 'parses a project gl_repository' do it 'parses a project gl_repository' do
expect(described_class.parse("project-#{project.id}")).to eq([project, false]) expect(described_class.parse("project-#{project.id}")).to eq([project, false])
......
...@@ -2,11 +2,11 @@ require 'spec_helper' ...@@ -2,11 +2,11 @@ require 'spec_helper'
describe 'forked project import' do describe 'forked project import' do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:project_with_repo) { create(:project, name: 'test-repo-restorer', path: 'test-repo-restorer') } let!(:project_with_repo) { create(:project, :repository, name: 'test-repo-restorer', path: 'test-repo-restorer') }
let!(:project) { create(:empty_project, name: 'test-repo-restorer-no-repo', path: 'test-repo-restorer-no-repo') } let!(:project) { create(:empty_project, name: 'test-repo-restorer-no-repo', path: 'test-repo-restorer-no-repo') }
let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" } let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" }
let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) } let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) }
let(:forked_from_project) { create(:project) } let(:forked_from_project) { create(:project, :repository) }
let(:fork_link) { create(:forked_project_link, forked_from_project: project_with_repo) } let(:fork_link) { create(:forked_project_link, forked_from_project: project_with_repo) }
let(:repo_saver) { Gitlab::ImportExport::RepoSaver.new(project: project_with_repo, shared: shared) } let(:repo_saver) { Gitlab::ImportExport::RepoSaver.new(project: project_with_repo, shared: shared) }
let(:bundle_path) { File.join(shared.export_path, Gitlab::ImportExport.project_bundle_filename) } let(:bundle_path) { File.join(shared.export_path, Gitlab::ImportExport.project_bundle_filename) }
......
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
describe Gitlab::ImportExport::MergeRequestParser do describe Gitlab::ImportExport::MergeRequestParser do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:project) { create(:project, name: 'test-repo-restorer', path: 'test-repo-restorer') } let!(:project) { create(:project, :repository, name: 'test-repo-restorer', path: 'test-repo-restorer') }
let(:forked_from_project) { create(:project) } let(:forked_from_project) { create(:project, :repository) }
let(:fork_link) { create(:forked_project_link, forked_from_project: project) } let(:fork_link) { create(:forked_project_link, forked_from_project: project) }
let!(:merge_request) do let!(:merge_request) do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Gitlab::ImportExport::RepoRestorer do describe Gitlab::ImportExport::RepoRestorer do
describe 'bundle a project Git repo' do describe 'bundle a project Git repo' do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:project_with_repo) { create(:project, name: 'test-repo-restorer', path: 'test-repo-restorer') } let!(:project_with_repo) { create(:project, :repository, name: 'test-repo-restorer', path: 'test-repo-restorer') }
let!(:project) { create(:empty_project) } let!(:project) { create(:empty_project) }
let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" } let(:export_path) { "#{Dir.tmpdir}/project_tree_saver_spec" }
let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) } let(:shared) { Gitlab::ImportExport::Shared.new(relative_path: project.full_path) }
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::IssuableSorter do describe Gitlab::IssuableSorter do
let(:namespace1) { build(:namespace, id: 1) } let(:namespace1) { build_stubbed(:namespace, id: 1) }
let(:project1) { build(:project, id: 1, namespace: namespace1) } let(:project1) { build_stubbed(:empty_project, id: 1, namespace: namespace1) }
let(:project2) { build(:project, id: 2, path: "a", namespace: project1.namespace) } let(:project2) { build_stubbed(:empty_project, id: 2, path: "a", namespace: project1.namespace) }
let(:project3) { build(:project, id: 3, path: "b", namespace: project1.namespace) } let(:project3) { build_stubbed(:empty_project, id: 3, path: "b", namespace: project1.namespace) }
let(:namespace2) { build(:namespace, id: 2, path: "a") } let(:namespace2) { build_stubbed(:namespace, id: 2, path: "a") }
let(:namespace3) { build(:namespace, id: 3, path: "b") } let(:namespace3) { build_stubbed(:namespace, id: 3, path: "b") }
let(:project4) { build(:project, id: 4, path: "a", namespace: namespace2) } let(:project4) { build_stubbed(:empty_project, id: 4, path: "a", namespace: namespace2) }
let(:project5) { build(:project, id: 5, path: "b", namespace: namespace2) } let(:project5) { build_stubbed(:empty_project, id: 5, path: "b", namespace: namespace2) }
let(:project6) { build(:project, id: 6, path: "a", namespace: namespace3) } let(:project6) { build_stubbed(:empty_project, id: 6, path: "a", namespace: namespace3) }
let(:unsorted) { [sorted[2], sorted[3], sorted[0], sorted[1]] } let(:unsorted) { [sorted[2], sorted[3], sorted[0], sorted[1]] }
let(:sorted) do let(:sorted) do
[build(:issue, iid: 1, project: project1), [build_stubbed(:issue, iid: 1, project: project1),
build(:issue, iid: 2, project: project1), build_stubbed(:issue, iid: 2, project: project1),
build(:issue, iid: 10, project: project1), build_stubbed(:issue, iid: 10, project: project1),
build(:issue, iid: 20, project: project1)] build_stubbed(:issue, iid: 20, project: project1)]
end end
it 'sorts references by a given key' do it 'sorts references by a given key' do
...@@ -41,14 +41,14 @@ describe Gitlab::IssuableSorter do ...@@ -41,14 +41,14 @@ describe Gitlab::IssuableSorter do
context 'for references from multiple projects and namespaces' do context 'for references from multiple projects and namespaces' do
let(:sorted) do let(:sorted) do
[build(:issue, iid: 1, project: project1), [build_stubbed(:issue, iid: 1, project: project1),
build(:issue, iid: 2, project: project1), build_stubbed(:issue, iid: 2, project: project1),
build(:issue, iid: 10, project: project1), build_stubbed(:issue, iid: 10, project: project1),
build(:issue, iid: 1, project: project2), build_stubbed(:issue, iid: 1, project: project2),
build(:issue, iid: 1, project: project3), build_stubbed(:issue, iid: 1, project: project3),
build(:issue, iid: 1, project: project4), build_stubbed(:issue, iid: 1, project: project4),
build(:issue, iid: 1, project: project5), build_stubbed(:issue, iid: 1, project: project5),
build(:issue, iid: 1, project: project6)] build_stubbed(:issue, iid: 1, project: project6)]
end end
let(:unsorted) do let(:unsorted) do
[sorted[3], sorted[1], sorted[4], sorted[2], [sorted[3], sorted[1], sorted[4], sorted[2],
......
...@@ -18,7 +18,7 @@ describe Gitlab::Middleware::Go do ...@@ -18,7 +18,7 @@ describe Gitlab::Middleware::Go do
let(:current_user) { nil } let(:current_user) { nil }
context 'with simple 2-segment project path' do context 'with simple 2-segment project path' do
let!(:project) { create(:project, :private) } let!(:project) { create(:empty_project, :private) }
context 'with subpackages' do context 'with subpackages' do
let(:path) { "#{project.full_path}/subpackage" } let(:path) { "#{project.full_path}/subpackage" }
...@@ -39,7 +39,7 @@ describe Gitlab::Middleware::Go do ...@@ -39,7 +39,7 @@ describe Gitlab::Middleware::Go do
context 'with a nested project path' do context 'with a nested project path' do
let(:group) { create(:group, :nested) } let(:group) { create(:group, :nested) }
let!(:project) { create(:project, :public, namespace: group) } let!(:project) { create(:empty_project, :public, namespace: group) }
shared_examples 'a nested project' do shared_examples 'a nested project' do
context 'when the project is public' do context 'when the project is public' do
......
...@@ -100,14 +100,14 @@ describe Gitlab::ProjectSearchResults do ...@@ -100,14 +100,14 @@ describe Gitlab::ProjectSearchResults do
end end
describe 'wiki search' do describe 'wiki search' do
let(:project) { create(:project, :public) } let(:project) { create(:empty_project, :public) }
let(:wiki) { build(:project_wiki, project: project) } let(:wiki) { build(:project_wiki, project: project) }
let!(:wiki_page) { wiki.create_page('Title', 'Content') } let!(:wiki_page) { wiki.create_page('Title', 'Content') }
subject(:results) { described_class.new(user, project, 'Content').objects('wiki_blobs') } subject(:results) { described_class.new(user, project, 'Content').objects('wiki_blobs') }
context 'when wiki is disabled' do context 'when wiki is disabled' do
let(:project) { create(:project, :public, :wiki_disabled) } let(:project) { create(:empty_project, :public, :wiki_disabled) }
it 'hides wiki blobs from members' do it 'hides wiki blobs from members' do
project.add_reporter(user) project.add_reporter(user)
...@@ -121,7 +121,7 @@ describe Gitlab::ProjectSearchResults do ...@@ -121,7 +121,7 @@ describe Gitlab::ProjectSearchResults do
end end
context 'when wiki is internal' do context 'when wiki is internal' do
let(:project) { create(:project, :public, :wiki_private) } let(:project) { create(:empty_project, :public, :wiki_private) }
it 'finds wiki blobs for guest' do it 'finds wiki blobs for guest' do
project.add_guest(user) project.add_guest(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe ::Gitlab::RepoPath do describe ::Gitlab::RepoPath do
describe '.parse' do describe '.parse' do
set(:project) { create(:project) } set(:project) { create(:project, :repository) }
context 'a repository storage path' do context 'a repository storage path' do
it 'parses a full repository path' do it 'parses a full repository path' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::UserAccess do describe Gitlab::UserAccess do
let(:access) { described_class.new(user, project: project) } let(:access) { described_class.new(user, project: project) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
describe '#can_push_to_branch?' do describe '#can_push_to_branch?' do
......
...@@ -58,7 +58,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -58,7 +58,7 @@ describe RenameSystemNamespaces, truncate: true do
end end
it "renames the route for projects of the namespace" do it "renames the route for projects of the namespace" do
project = build(:project, path: "project-path", namespace: system_namespace) project = build(:project, :repository, path: "project-path", namespace: system_namespace)
save_invalid_routable(project) save_invalid_routable(project)
migration.up migration.up
...@@ -68,7 +68,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -68,7 +68,7 @@ describe RenameSystemNamespaces, truncate: true do
it "doesn't touch routes of namespaces that look like system" do it "doesn't touch routes of namespaces that look like system" do
namespace = create(:group, path: 'systemlookalike') namespace = create(:group, path: 'systemlookalike')
project = create(:project, namespace: namespace, path: 'the-project') project = create(:project, :repository, namespace: namespace, path: 'the-project')
migration.up migration.up
...@@ -77,7 +77,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -77,7 +77,7 @@ describe RenameSystemNamespaces, truncate: true do
end end
it "moves the the repository for a project in the namespace" do it "moves the the repository for a project in the namespace" do
project = build(:project, namespace: system_namespace, path: "system-project") project = build(:project, :repository, namespace: system_namespace, path: "system-project")
save_invalid_routable(project) save_invalid_routable(project)
TestEnv.copy_repo(project, TestEnv.copy_repo(project,
bare_repo: TestEnv.factory_repo_path_bare, bare_repo: TestEnv.factory_repo_path_bare,
...@@ -105,7 +105,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -105,7 +105,7 @@ describe RenameSystemNamespaces, truncate: true do
describe "clears the markdown cache for projects in the system namespace" do describe "clears the markdown cache for projects in the system namespace" do
let!(:project) do let!(:project) do
project = build(:project, namespace: system_namespace) project = build(:project, :repository, namespace: system_namespace)
save_invalid_routable(project) save_invalid_routable(project)
project project
end end
...@@ -161,7 +161,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -161,7 +161,7 @@ describe RenameSystemNamespaces, truncate: true do
it "updates the route of the project correctly" do it "updates the route of the project correctly" do
subgroup = build(:group, path: "subgroup", parent: system_namespace) subgroup = build(:group, path: "subgroup", parent: system_namespace)
save_invalid_routable(subgroup) save_invalid_routable(subgroup)
project = build(:project, path: "system0", namespace: subgroup) project = build(:project, :repository, path: "system0", namespace: subgroup)
save_invalid_routable(project) save_invalid_routable(project)
migration.up migration.up
...@@ -174,7 +174,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -174,7 +174,7 @@ describe RenameSystemNamespaces, truncate: true do
describe "#move_repositories" do describe "#move_repositories" do
let(:namespace) { create(:group, name: "hello-group") } let(:namespace) { create(:group, name: "hello-group") }
it "moves a project for a namespace" do it "moves a project for a namespace" do
create(:project, namespace: namespace, path: "hello-project") create(:project, :repository, namespace: namespace, path: "hello-project")
expected_path = File.join(TestEnv.repos_path, "bye-group", "hello-project.git") expected_path = File.join(TestEnv.repos_path, "bye-group", "hello-project.git")
migration.move_repositories(namespace, "hello-group", "bye-group") migration.move_repositories(namespace, "hello-group", "bye-group")
...@@ -184,7 +184,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -184,7 +184,7 @@ describe RenameSystemNamespaces, truncate: true do
it "moves a namespace in a subdirectory correctly" do it "moves a namespace in a subdirectory correctly" do
child_namespace = create(:group, name: "sub-group", parent: namespace) child_namespace = create(:group, name: "sub-group", parent: namespace)
create(:project, namespace: child_namespace, path: "hello-project") create(:project, :repository, namespace: child_namespace, path: "hello-project")
expected_path = File.join(TestEnv.repos_path, "hello-group", "renamed-sub-group", "hello-project.git") expected_path = File.join(TestEnv.repos_path, "hello-group", "renamed-sub-group", "hello-project.git")
...@@ -195,7 +195,7 @@ describe RenameSystemNamespaces, truncate: true do ...@@ -195,7 +195,7 @@ describe RenameSystemNamespaces, truncate: true do
it "moves a parent namespace with subdirectories" do it "moves a parent namespace with subdirectories" do
child_namespace = create(:group, name: "sub-group", parent: namespace) child_namespace = create(:group, name: "sub-group", parent: namespace)
create(:project, namespace: child_namespace, path: "hello-project") create(:project, :repository, namespace: child_namespace, path: "hello-project")
expected_path = File.join(TestEnv.repos_path, "renamed-group", "sub-group", "hello-project.git") expected_path = File.join(TestEnv.repos_path, "renamed-group", "sub-group", "hello-project.git")
migration.move_repositories(child_namespace, "hello-group", "renamed-group") migration.move_repositories(child_namespace, "hello-group", "renamed-group")
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::ComposerJson do describe BlobViewer::ComposerJson do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
{ {
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::Gemspec do describe BlobViewer::Gemspec do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
Gem::Specification.new do |s| Gem::Specification.new do |s|
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::GitlabCiYml do describe BlobViewer::GitlabCiYml do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) } let(:data) { File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) }
let(:blob) { fake_blob(path: '.gitlab-ci.yml', data: data) } let(:blob) { fake_blob(path: '.gitlab-ci.yml', data: data) }
subject { described_class.new(blob) } subject { described_class.new(blob) }
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::PackageJson do describe BlobViewer::PackageJson do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
{ {
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::PodspecJson do describe BlobViewer::PodspecJson do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
{ {
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::Podspec do describe BlobViewer::Podspec do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-SPEC.strip_heredoc <<-SPEC.strip_heredoc
Pod::Spec.new do |spec| Pod::Spec.new do |spec|
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe BlobViewer::RouteMap do describe BlobViewer::RouteMap do
include FakeBlobHelpers include FakeBlobHelpers
let(:project) { build(:project) } let(:project) { build_stubbed(:empty_project) }
let(:data) do let(:data) do
<<-MAP.strip_heredoc <<-MAP.strip_heredoc
# Team data # Team data
......
...@@ -24,7 +24,7 @@ describe Participable do ...@@ -24,7 +24,7 @@ describe Participable do
user1 = build(:user) user1 = build(:user)
user2 = build(:user) user2 = build(:user)
user3 = build(:user) user3 = build(:user)
project = build(:project, :public) project = build(:empty_project, :public)
instance = model.new instance = model.new
expect(instance).to receive(:foo).and_return(user2) expect(instance).to receive(:foo).and_return(user2)
...@@ -57,7 +57,7 @@ describe Participable do ...@@ -57,7 +57,7 @@ describe Participable do
other = other_model.new other = other_model.new
user1 = build(:user) user1 = build(:user)
user2 = build(:user) user2 = build(:user)
project = build(:project, :public) project = build(:empty_project, :public)
expect(instance).to receive(:foo).and_return(other) expect(instance).to receive(:foo).and_return(other)
expect(other).to receive(:bar).and_return(user2) expect(other).to receive(:bar).and_return(user2)
...@@ -69,7 +69,7 @@ describe Participable do ...@@ -69,7 +69,7 @@ describe Participable do
context 'when using a Proc as an attribute' do context 'when using a Proc as an attribute' do
it 'calls the supplied Proc' do it 'calls the supplied Proc' do
user1 = build(:user) user1 = build(:user)
project = build(:project, :public) project = build(:empty_project, :public)
user_arg = nil user_arg = nil
ext_arg = nil ext_arg = nil
......
require 'spec_helper' require 'spec_helper'
describe Note, ResolvableNote do describe Note, ResolvableNote do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
subject { create(:discussion_note_on_merge_request, noteable: merge_request, project: project) } subject { create(:discussion_note_on_merge_request, noteable: merge_request, project: project) }
......
...@@ -27,7 +27,7 @@ describe Group, 'Routable' do ...@@ -27,7 +27,7 @@ describe Group, 'Routable' do
it 'ensure route path uniqueness across different objects' do it 'ensure route path uniqueness across different objects' do
create(:group, parent: group, path: 'xyz') 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') expect { duplicate.save! }.to raise_error(ActiveRecord::RecordInvalid, 'Validation failed: Route path has already been taken, Route is invalid')
end end
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe ContainerRepository do describe ContainerRepository do
let(:group) { create(:group, name: 'group') } let(:group) { create(:group, name: 'group') }
let(:project) { create(:project, path: 'test', group: group) } let(:project) { create(:project, :repository, path: 'test', group: group) }
let(:repository) do let(:repository) do
create(:container_repository, name: 'my_image', project: project) create(:container_repository, name: 'my_image', project: project)
...@@ -41,7 +41,7 @@ describe ContainerRepository do ...@@ -41,7 +41,7 @@ describe ContainerRepository do
end end
context 'when path contains uppercase letters' do 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 it 'returns a full path without capital letters' do
expect(repository.path).to eq('group/my_project/my_image') expect(repository.path).to eq('group/my_project/my_image')
......
...@@ -91,7 +91,7 @@ describe Deployment do ...@@ -91,7 +91,7 @@ describe Deployment do
end end
describe '#additional_metrics' do describe '#additional_metrics' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:deployment) { create(:deployment, project: project) } let(:deployment) { create(:deployment, project: project) }
subject { deployment.additional_metrics } subject { deployment.additional_metrics }
......
...@@ -5,7 +5,7 @@ describe DiffDiscussion do ...@@ -5,7 +5,7 @@ describe DiffDiscussion do
subject { described_class.new([diff_note]) } 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(: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) } let(:diff_note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) }
......
...@@ -21,7 +21,7 @@ describe Environment do ...@@ -21,7 +21,7 @@ describe Environment do
it { is_expected.to validate_uniqueness_of(:external_url).scoped_to(:project_id) } it { is_expected.to validate_uniqueness_of(:external_url).scoped_to(:project_id) }
describe '.order_by_last_deployed_at' do describe '.order_by_last_deployed_at' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let!(:environment1) { create(:environment, project: project) } let!(:environment1) { create(:environment, project: project) }
let!(:environment2) { create(:environment, project: project) } let!(:environment2) { create(:environment, project: project) }
let!(:environment3) { create(:environment, project: project) } let!(:environment3) { create(:environment, project: project) }
......
...@@ -41,7 +41,7 @@ describe ForkedProjectLink, "add link on fork" do ...@@ -41,7 +41,7 @@ describe ForkedProjectLink, "add link on fork" do
end end
describe '#forked?' do 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) } let(:forked_project_link) { create(:forked_project_link) }
before do before do
......
...@@ -16,7 +16,7 @@ RSpec.describe GpgSignature do ...@@ -16,7 +16,7 @@ RSpec.describe GpgSignature do
describe '#commit' do describe '#commit' do
it 'fetches the commit through the project' do it 'fetches the commit through the project' do
commit_sha = '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' commit_sha = '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
project = create :project project = create :project, :repository
commit = create :commit, project: project commit = create :commit, project: project
gpg_signature = create :gpg_signature, commit_sha: commit_sha gpg_signature = create :gpg_signature, commit_sha: commit_sha
......
...@@ -724,7 +724,7 @@ describe Issue do ...@@ -724,7 +724,7 @@ describe Issue do
end end
describe '#check_for_spam' do 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 } let(:issue) { create :issue, project: project }
subject do subject do
......
...@@ -9,7 +9,7 @@ describe ProjectGroupLink do ...@@ -9,7 +9,7 @@ describe ProjectGroupLink do
describe "Validation" do describe "Validation" do
let(:parent_group) { create(:group) } let(:parent_group) { create(:group) }
let(:group) { create(:group, parent: parent_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) } let!(:project_group_link) { create(:project_group_link, project: project) }
it { is_expected.to validate_presence_of(:project_id) } it { is_expected.to validate_presence_of(:project_id) }
......
...@@ -20,7 +20,7 @@ describe ChatNotificationService do ...@@ -20,7 +20,7 @@ describe ChatNotificationService do
context 'with repository' do context 'with repository' do
it 'returns true' do it 'returns true' do
subject.project = create(:project) subject.project = create(:project, :repository)
expect(subject.can_test?).to be true expect(subject.can_test?).to be true
end end
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe IssueTrackerService do describe IssueTrackerService do
describe 'Validations' do describe 'Validations' do
let(:project) { create :project } let(:project) { create :empty_project }
describe 'only one issue tracker per project' do describe 'only one issue tracker per project' do
let(:service) { RedmineService.new(project: project, active: true) } let(:service) { RedmineService.new(project: project, active: true) }
......
...@@ -190,7 +190,7 @@ describe JiraService do ...@@ -190,7 +190,7 @@ describe JiraService do
describe '#test_settings' do describe '#test_settings' do
let(:jira_service) do let(:jira_service) do
described_class.new( described_class.new(
project: create(:project), project: create(:empty_project),
url: 'http://jira.example.com', url: 'http://jira.example.com',
username: 'jira_username', username: 'jira_username',
password: 'jira_password' password: 'jira_password'
......
...@@ -261,27 +261,27 @@ describe Project do ...@@ -261,27 +261,27 @@ describe Project do
describe 'path validation' do describe 'path validation' do
it 'allows paths reserved on the root namespace' 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 expect(project).to be_valid
end end
it 'rejects paths reserved on another level' do 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 expect(project).not_to be_valid
end end
it 'rejects nested paths' do it 'rejects nested paths' do
parent = create(:group, :nested, path: 'environments') 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 expect(project).not_to be_valid
end end
it 'allows a reserved group name' do it 'allows a reserved group name' do
parent = create(:group) parent = create(:group)
project = build(:project, path: 'avatar', namespace: parent) project = build(:empty_project, path: 'avatar', namespace: parent)
expect(project).to be_valid expect(project).to be_valid
end end
...@@ -2045,7 +2045,7 @@ describe Project do ...@@ -2045,7 +2045,7 @@ describe Project do
end end
describe '#route_map_for' do describe '#route_map_for' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:route_map) do let(:route_map) do
<<-MAP.strip_heredoc <<-MAP.strip_heredoc
- source: /source/(.*)/ - source: /source/(.*)/
...@@ -2082,7 +2082,7 @@ describe Project do ...@@ -2082,7 +2082,7 @@ describe Project do
end end
describe '#public_path_for_source_path' do describe '#public_path_for_source_path' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:route_map) do let(:route_map) do
Gitlab::RouteMap.new(<<-MAP.strip_heredoc) Gitlab::RouteMap.new(<<-MAP.strip_heredoc)
- source: /source/(.*)/ - source: /source/(.*)/
...@@ -2196,7 +2196,7 @@ describe Project do ...@@ -2196,7 +2196,7 @@ describe Project do
end end
describe '#pipeline_status' do describe '#pipeline_status' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
it 'builds a pipeline status' do it 'builds a pipeline status' do
expect(project.pipeline_status).to be_a(Gitlab::Cache::Ci::ProjectPipelineStatus) expect(project.pipeline_status).to be_a(Gitlab::Cache::Ci::ProjectPipelineStatus)
end end
...@@ -2207,7 +2207,7 @@ describe Project do ...@@ -2207,7 +2207,7 @@ describe Project do
end end
describe '#append_or_update_attribute' do describe '#append_or_update_attribute' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
it 'shows full error updating an invalid MR' do 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.'\ error_message = 'Failed to replace merge_requests because one or more of the new records could not be saved.'\
......
...@@ -330,7 +330,7 @@ describe ProjectTeam do ...@@ -330,7 +330,7 @@ describe ProjectTeam do
end end
shared_examples 'max member access for users' do shared_examples 'max member access for users' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:second_group) { create(:group) } let(:second_group) { create(:group) }
......
...@@ -300,7 +300,7 @@ describe Repository do ...@@ -300,7 +300,7 @@ describe Repository do
end end
context "when committing to another project" do 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 it "creates a fork and commit to the forked project" do
expect do expect do
......
...@@ -21,7 +21,7 @@ describe SentNotification do ...@@ -21,7 +21,7 @@ describe SentNotification do
end end
context "when the noteable project and discussion project match" do 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(:issue) { create(:issue, project: project) }
let(:discussion_id) { create(:note, project: project, noteable: issue).discussion_id } 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) } subject { build(:sent_notification, project: project, noteable: issue, in_reply_to_discussion_id: discussion_id) }
...@@ -128,7 +128,7 @@ describe SentNotification do ...@@ -128,7 +128,7 @@ describe SentNotification do
end end
context 'for commit' do context 'for commit' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:commit) { project.commit } let(:commit) { project.commit }
subject { described_class.record(commit, project.creator.id) } subject { described_class.record(commit, project.creator.id) }
......
...@@ -97,7 +97,7 @@ describe Ci::BuildPolicy do ...@@ -97,7 +97,7 @@ describe Ci::BuildPolicy do
end end
describe 'rules for protected ref' do 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) } let(:build) { create(:ci_build, ref: 'some-ref', pipeline: pipeline) }
before do before do
......
...@@ -10,7 +10,7 @@ describe Ci::PipelinePolicy, :models do ...@@ -10,7 +10,7 @@ describe Ci::PipelinePolicy, :models do
describe 'rules' do describe 'rules' do
describe 'rules for protected ref' do describe 'rules for protected ref' do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
project.add_developer(user) project.add_developer(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe EnvironmentPolicy do describe EnvironmentPolicy do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:environment) do let(:environment) do
create(:environment, :with_review_app, project: project) create(:environment, :with_review_app, project: project)
...@@ -14,7 +14,7 @@ describe EnvironmentPolicy do ...@@ -14,7 +14,7 @@ describe EnvironmentPolicy do
describe '#rules' do describe '#rules' do
context 'when user does not have access to the project' 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 it 'does not include ability to stop environment' do
expect(policy).to be_disallowed :stop_environment expect(policy).to be_disallowed :stop_environment
...@@ -22,7 +22,7 @@ describe EnvironmentPolicy do ...@@ -22,7 +22,7 @@ describe EnvironmentPolicy do
end end
context 'when anonymous user has access to the project' do 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 it 'does not include ability to stop environment' do
expect(policy).to be_disallowed :stop_environment expect(policy).to be_disallowed :stop_environment
...@@ -30,7 +30,7 @@ describe EnvironmentPolicy do ...@@ -30,7 +30,7 @@ describe EnvironmentPolicy do
end end
context 'when team member has access to the project' do context 'when team member has access to the project' do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
before do before do
project.add_developer(user) project.add_developer(user)
......
...@@ -105,7 +105,7 @@ describe MergeRequestPresenter do ...@@ -105,7 +105,7 @@ describe MergeRequestPresenter do
end end
context 'issues links' do 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_a) { create(:issue, project: project) }
let(:issue_b) { create(:issue, project: project) } let(:issue_b) { create(:issue, project: project) }
......
...@@ -80,7 +80,7 @@ describe API::Files do ...@@ -80,7 +80,7 @@ describe API::Files do
context 'when unauthenticated', 'and project is public' do context 'when unauthenticated', 'and project is public' do
it_behaves_like 'repository files' do it_behaves_like 'repository files' do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:current_user) { nil } let(:current_user) { nil }
end end
end end
...@@ -153,7 +153,7 @@ describe API::Files do ...@@ -153,7 +153,7 @@ describe API::Files do
context 'when unauthenticated', 'and project is public' do context 'when unauthenticated', 'and project is public' do
it_behaves_like 'repository raw files' do it_behaves_like 'repository raw files' do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:current_user) { nil } let(:current_user) { nil }
end end
end end
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe API::PipelineSchedules do describe API::PipelineSchedules do
set(:developer) { create(:user) } set(:developer) { create(:user) }
set(:user) { create(:user) } set(:user) { create(:user) }
set(:project) { create(:project) } set(:project) { create(:project, :repository) }
before do before do
project.add_developer(developer) project.add_developer(developer)
......
require 'spec_helper' require 'spec_helper'
describe API::Todos do describe API::Todos do
let(:project_1) { create(:project) } let(:project_1) { create(:project, :repository) }
let(:project_2) { create(:empty_project) } let(:project_2) { create(:empty_project) }
let(:author_1) { create(:user) } let(:author_1) { create(:user) }
let(:author_2) { create(:user) } let(:author_2) { create(:user) }
......
...@@ -13,7 +13,7 @@ describe API::Triggers do ...@@ -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') } 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 describe 'POST /projects/:project_id/trigger/pipeline' do
let!(:project2) { create(:project) } let!(:project2) { create(:project, :repository) }
let(:options) do let(:options) do
{ {
token: trigger_token token: trigger_token
......
...@@ -74,7 +74,7 @@ describe API::V3::Files do ...@@ -74,7 +74,7 @@ describe API::V3::Files do
context 'when unauthenticated', 'and project is public' do context 'when unauthenticated', 'and project is public' do
it_behaves_like 'repository files' do it_behaves_like 'repository files' do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:current_user) { nil } let(:current_user) { nil }
end end
end end
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe API::ProjectHooks, 'ProjectHooks' do describe API::ProjectHooks, 'ProjectHooks' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:user3) { 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 let!(:hook) do
create(:project_hook, create(:project_hook,
:all_events_enabled, :all_events_enabled,
...@@ -204,7 +204,7 @@ describe API::ProjectHooks, 'ProjectHooks' do ...@@ -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 it "returns a 404 if a user attempts to delete project hooks he/she does not own" do
test_user = create(:user) test_user = create(:user)
other_project = create(:project) other_project = create(:empty_project)
other_project.team << [test_user, :master] other_project.team << [test_user, :master]
delete v3_api("/projects/#{other_project.id}/hooks/#{hook.id}", test_user) delete v3_api("/projects/#{other_project.id}/hooks/#{hook.id}", test_user)
......
...@@ -10,7 +10,7 @@ describe API::V3::Triggers do ...@@ -10,7 +10,7 @@ describe API::V3::Triggers do
let!(:trigger) { create(:ci_trigger, project: project, token: trigger_token) } let!(:trigger) { create(:ci_trigger, project: project, token: trigger_token) }
describe 'POST /projects/:project_id/trigger' do describe 'POST /projects/:project_id/trigger' do
let!(:project2) { create(:project) } let!(:project2) { create(:empty_project) }
let(:options) do let(:options) do
{ {
token: trigger_token token: trigger_token
......
...@@ -600,7 +600,7 @@ describe 'Git LFS API and storage' do ...@@ -600,7 +600,7 @@ describe 'Git LFS API and storage' do
context 'when user is not authenticated' do context 'when user is not authenticated' do
describe 'is accessing public project' do describe 'is accessing public project' do
let(:project) { create(:project, :public) } let(:project) { create(:empty_project, :public) }
let(:update_lfs_permissions) do let(:update_lfs_permissions) do
project.lfs_objects << lfs_object project.lfs_objects << lfs_object
...@@ -642,7 +642,7 @@ describe 'Git LFS API and storage' do ...@@ -642,7 +642,7 @@ describe 'Git LFS API and storage' do
end end
describe 'upload' do describe 'upload' do
let(:project) { create(:project, :public) } let(:project) { create(:empty_project, :public) }
let(:body) do let(:body) do
{ {
'operation' => 'upload', 'operation' => 'upload',
...@@ -1019,7 +1019,7 @@ describe 'Git LFS API and storage' do ...@@ -1019,7 +1019,7 @@ describe 'Git LFS API and storage' do
end end
describe 'to a forked project' do 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_owner) { create(:user) }
let(:project) { fork_project(upstream_project, project_owner) } let(:project) { fork_project(upstream_project, project_owner) }
......
...@@ -13,7 +13,7 @@ describe 'Request Profiler' do ...@@ -13,7 +13,7 @@ describe 'Request Profiler' do
end end
it 'creates a profile of the request' do it 'creates a profile of the request' do
project = create(:project, namespace: user.namespace) project = create(:empty_project, namespace: user.namespace)
time = Time.now time = Time.now
path = "/#{project.full_path}" path = "/#{project.full_path}"
......
...@@ -75,7 +75,7 @@ describe Ci::CreatePipelineService do ...@@ -75,7 +75,7 @@ describe Ci::CreatePipelineService do
end end
context 'when merge request target project is different from source project' do 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) } 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 it 'updates head pipeline for merge request' do
......
...@@ -33,7 +33,7 @@ describe Ci::PlayBuildService, '#execute' do ...@@ -33,7 +33,7 @@ describe Ci::PlayBuildService, '#execute' do
end end
context 'when project has repository' do 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 it 'allows user with developer role to play a build' do
project.add_developer(user) project.add_developer(user)
......
...@@ -2,9 +2,9 @@ require 'spec_helper' ...@@ -2,9 +2,9 @@ require 'spec_helper'
describe Labels::CreateService do describe Labels::CreateService do
describe '#execute' do describe '#execute' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:hex_color) { '#FF0000' } let(:hex_color) { '#FF0000' }
let(:named_color) { 'red' } let(:named_color) { 'red' }
let(:upcase_color) { 'RED' } let(:upcase_color) { 'RED' }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Labels::UpdateService do describe Labels::UpdateService do
describe '#execute' do describe '#execute' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:hex_color) { '#FF0000' } let(:hex_color) { '#FF0000' }
let(:named_color) { 'red' } let(:named_color) { 'red' }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Milestones::DestroyService do describe Milestones::DestroyService do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:milestone) { create(:milestone, title: 'Milestone v1.0', project: project) } let(:milestone) { create(:milestone, title: 'Milestone v1.0', project: project) }
let(:issue) { create(:issue, project: project, milestone: milestone) } let(:issue) { create(:issue, project: project, milestone: milestone) }
let(:merge_request) { create(:merge_request, source_project: project, milestone: milestone) } let(:merge_request) { create(:merge_request, source_project: project, milestone: milestone) }
......
...@@ -40,7 +40,7 @@ describe Users::DestroyService do ...@@ -40,7 +40,7 @@ describe Users::DestroyService do
end end
context "a deleted user's issues" do context "a deleted user's issues" do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
before do before do
project.add_developer(user) project.add_developer(user)
...@@ -66,7 +66,7 @@ describe Users::DestroyService do ...@@ -66,7 +66,7 @@ describe Users::DestroyService do
end end
context "a deleted user's merge_requests" do context "a deleted user's merge_requests" do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
before do before do
project.add_developer(user) project.add_developer(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Users::MigrateToGhostUserService do describe Users::MigrateToGhostUserService do
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:project) { create(:project) } let!(:project) { create(:project, :repository) }
let(:service) { described_class.new(user) } let(:service) { described_class.new(user) }
context "migrating a user's associated records to the ghost user" do context "migrating a user's associated records to the ghost user" do
......
...@@ -5,7 +5,14 @@ shared_examples 'issuable record that supports quick actions in its description ...@@ -5,7 +5,14 @@ shared_examples 'issuable record that supports quick actions in its description
include QuickActionsHelpers include QuickActionsHelpers
let(:master) { create(:user) } 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!(:milestone) { create(:milestone, project: project, title: 'ASAP') }
let!(:label_bug) { create(:label, project: project, title: 'bug') } let!(:label_bug) { create(:label, project: project, title: 'bug') }
let!(:label_feature) { create(:label, project: project, title: 'feature') } let!(:label_feature) { create(:label, project: project, title: 'feature') }
......
...@@ -6,7 +6,7 @@ module ExportFileHelper ...@@ -6,7 +6,7 @@ module ExportFileHelper
ObjectWithParent = Struct.new(:object, :parent, :key_found) ObjectWithParent = Struct.new(:object, :parent, :key_found)
def setup_project def setup_project
project = create(:project, :public) project = create(:project, :public, :repository)
create(:release, project: project) create(:release, project: project)
......
...@@ -3,7 +3,14 @@ require "spec_helper" ...@@ -3,7 +3,14 @@ require "spec_helper"
shared_examples "migrating a deleted user's associated records to the ghost user" do |record_class, fields| 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 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 before do
project.add_developer(user) project.add_developer(user)
......
...@@ -5,7 +5,7 @@ describe FileUploader do ...@@ -5,7 +5,7 @@ describe FileUploader do
describe '.absolute_path' do describe '.absolute_path' do
it 'returns the correct absolute path by building it dynamically' 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') upload = double(model: project, path: 'secret/foo.jpg')
dynamic_segment = project.path_with_namespace dynamic_segment = project.path_with_namespace
......
...@@ -28,7 +28,7 @@ describe DynamicPathValidator do ...@@ -28,7 +28,7 @@ describe DynamicPathValidator do
describe '#path_valid_for_record?' do describe '#path_valid_for_record?' do
context 'for project' do context 'for project' do
it 'calls valid_project_path?' 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 expect(described_class).to receive(:valid_project_path?).with(project.full_path).and_call_original
......
...@@ -5,7 +5,7 @@ describe 'layouts/nav/_project' do ...@@ -5,7 +5,7 @@ describe 'layouts/nav/_project' do
before do before do
stub_container_registry_config(enabled: true) 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(:current_ref).and_return('master')
allow(view).to receive(:can?).and_return(true) allow(view).to receive(:can?).and_return(true)
......
...@@ -4,7 +4,7 @@ describe 'notify/pipeline_failed_email.html.haml' do ...@@ -4,7 +4,7 @@ describe 'notify/pipeline_failed_email.html.haml' do
include Devise::Test::ControllerHelpers include Devise::Test::ControllerHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) } let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:pipeline) do let(:pipeline) do
......
...@@ -4,7 +4,7 @@ describe 'notify/pipeline_success_email.html.haml' do ...@@ -4,7 +4,7 @@ describe 'notify/pipeline_success_email.html.haml' do
include Devise::Test::ControllerHelpers include Devise::Test::ControllerHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) } let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:pipeline) do let(:pipeline) do
......
...@@ -4,7 +4,7 @@ describe CreateGpgSignatureWorker do ...@@ -4,7 +4,7 @@ describe CreateGpgSignatureWorker do
context 'when GpgKey is found' do context 'when GpgKey is found' do
it 'calls Commit#signature' do it 'calls Commit#signature' do
commit_sha = '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' commit_sha = '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
project = create :project project = create :empty_project
commit = instance_double(Commit) commit = instance_double(Commit)
allow(Project).to receive(:find_by).with(id: project.id).and_return(project) allow(Project).to receive(:find_by).with(id: project.id).and_return(project)
...@@ -18,7 +18,7 @@ describe CreateGpgSignatureWorker do ...@@ -18,7 +18,7 @@ describe CreateGpgSignatureWorker do
context 'when Commit is not found' do context 'when Commit is not found' do
let(:nonexisting_commit_sha) { 'bogus' } let(:nonexisting_commit_sha) { 'bogus' }
let(:project) { create :project } let(:project) { create :empty_project }
it 'does not raise errors' do it 'does not raise errors' do
expect { described_class.new.perform(nonexisting_commit_sha, project.id) }.not_to raise_error expect { described_class.new.perform(nonexisting_commit_sha, project.id) }.not_to raise_error
......
...@@ -33,7 +33,7 @@ describe ProcessCommitWorker do ...@@ -33,7 +33,7 @@ describe ProcessCommitWorker do
end end
context 'when commit already exists in upstream project' do 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 it 'does not process commit message' do
create(:forked_project_link, forked_to_project: forked, forked_from_project: project) create(:forked_project_link, forked_to_project: forked, forked_from_project: project)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment