Commit 0bc1dfb6 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

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

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

See merge request !13238
......@@ -4,7 +4,7 @@
include StubENV
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
let(:project) { create(:empty_project, namespace: group) }
let(:admin) { create(:admin) }
let(:user) { create(:user)}
......
......@@ -8,8 +8,8 @@
it 'does not retrieve projects that are pending deletion' do
sign_in(create(:admin))
project = create(:project)
pending_delete_project = create(:project, pending_delete: true)
project = create(:empty_project)
pending_delete_project = create(:empty_project, pending_delete: true)
get :index
......
......@@ -65,7 +65,7 @@
end
context 'non-member login for public project' do
let!(:project) { create(:project, :public) }
let!(:project) { create(:empty_project, :public) }
before do
sign_in(non_member)
......@@ -127,7 +127,7 @@
end
context 'unauthenticated user' do
let(:public_project) { create(:project, :public) }
let(:public_project) { create(:empty_project, :public) }
let(:body) { JSON.parse(response.body) }
describe 'GET #users with public project' do
......@@ -231,8 +231,8 @@
end
context 'GET projects' do
let(:authorized_project) { create(:project) }
let(:authorized_search_project) { create(:project, name: 'rugged') }
let(:authorized_project) { create(:empty_project) }
let(:authorized_search_project) { create(:empty_project, name: 'rugged') }
before do
sign_in(user)
......@@ -289,8 +289,8 @@
context 'authorized projects apply limit' do
before do
authorized_project2 = create(:project)
authorized_project3 = create(:project)
authorized_project2 = create(:empty_project)
authorized_project3 = create(:empty_project)
authorized_project.add_master(user)
authorized_project2.add_master(user)
......@@ -315,8 +315,8 @@
context 'authorized projects with offset' do
before do
authorized_project2 = create(:project)
authorized_project3 = create(:project)
authorized_project2 = create(:empty_project)
authorized_project3 = create(:empty_project)
authorized_project.add_master(user)
authorized_project2.add_master(user)
......
......@@ -2,7 +2,7 @@
describe DashboardController do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
before do
project.team << [user, :master]
......
require 'spec_helper'
describe Projects::MergeRequests::ConflictsController do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:merge_request_with_conflicts) do
......
require 'spec_helper'
describe Projects::MergeRequests::CreationsController do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:fork_project) { create(:forked_project_with_submodules) }
......@@ -83,7 +83,7 @@ def diff_for_path(extra_params = {})
end
context 'when the source branch is in a different project to the target' do
let(:other_project) { create(:project) }
let(:other_project) { create(:project, :repository) }
before do
other_project.team << [user, :master]
......
require 'spec_helper'
describe Projects::MergeRequests::DiffsController do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
......@@ -36,7 +36,7 @@ def go(extra_params = {})
context 'with forked projects with submodules' do
render_views
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:fork_project) { create(:forked_project_with_submodules) }
let(:merge_request) { create(:merge_request_with_diffs, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) }
......
require 'spec_helper'
describe Projects::MergeRequestsController do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:merge_request_with_conflicts) do
......@@ -191,7 +191,7 @@ def get_merge_requests(page = nil)
end
context 'there is no source project' do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:fork_project) { create(:forked_project_with_submodules) }
let(:merge_request) { create(:merge_request, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) }
......@@ -429,7 +429,7 @@ def merge_when_pipeline_succeeds
context "when the user is owner" do
let(:owner) { create(:user) }
let(:namespace) { create(:namespace, owner: owner) }
let(:project) { create(:project, namespace: namespace) }
let(:project) { create(:project, :repository, namespace: namespace) }
before do
sign_in owner
......@@ -587,7 +587,7 @@ def post_assign_issues
describe 'GET ci_environments_status' do
context 'the environment is from a forked project' do
let!(:forked) { create(:project) }
let!(:forked) { create(:project, :repository) }
let!(:environment) { create(:environment, project: forked) }
let!(:deployment) { create(:deployment, environment: environment, sha: forked.commit.id, ref: 'master') }
let(:admin) { create(:admin) }
......
......@@ -167,10 +167,10 @@
end
context 'when creating a commit comment from an MR fork' do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:fork_project) do
create(:project).tap do |fork|
create(:project, :repository).tap do |fork|
create(:forked_project_link, forked_to_project: fork, forked_from_project: project)
end
end
......
......@@ -61,7 +61,7 @@
create_build('post deploy', 3, 'pages 0')
end
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:pipeline) do
create(:ci_empty_pipeline, project: project, user: user, sha: project.commit.id)
end
......
......@@ -156,7 +156,7 @@ def create_snippet(project, snippet_params = {}, additional_params = {})
end
describe 'PUT #update' do
let(:project) { create :project, :public }
let(:project) { create :empty_project, :public }
let(:snippet) { create :project_snippet, author: user, project: project, visibility_level: visibility_level }
def update_snippet(snippet_params = {}, additional_params = {})
......
......@@ -196,7 +196,7 @@
context "redirection from http://someproject.git" do
it 'redirects to project page (format.html)' do
project = create(:project, :public)
project = create(:empty_project, :public)
get :show, namespace_id: project.namespace, id: project, format: :git
......@@ -254,7 +254,7 @@ def update_project(**parameters)
describe '#transfer' do
render_views
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:admin) { create(:admin) }
let(:new_namespace) { create(:namespace) }
......@@ -311,8 +311,8 @@ def update_project(**parameters)
end
context "when the project is forked" do
let(:project) { create(:project) }
let(:fork_project) { create(:project, forked_from_project: project) }
let(:project) { create(:project, :repository) }
let(:fork_project) { create(:project, :repository, forked_from_project: project) }
let(:merge_request) do
create(:merge_request,
source_project: fork_project,
......@@ -390,7 +390,7 @@ def update_project(**parameters)
end
context 'with forked project' do
let(:project_fork) { create(:project, namespace: user.namespace) }
let(:project_fork) { create(:project, :repository, namespace: user.namespace) }
before do
create(:forked_project_link, forked_to_project: project_fork)
......@@ -408,7 +408,7 @@ def update_project(**parameters)
end
context 'when project not forked' do
let(:unforked_project) { create(:project, namespace: user.namespace) }
let(:unforked_project) { create(:empty_project, namespace: user.namespace) }
it 'does nothing if project was not forked' do
delete(:remove_fork,
......@@ -430,7 +430,7 @@ def update_project(**parameters)
end
describe "GET refs" do
let(:public_project) { create(:project, :public) }
let(:public_project) { create(:project, :public, :repository) }
it "gets a list of branches and tags" do
get :refs, namespace_id: public_project.namespace, id: public_project
......
......@@ -273,7 +273,7 @@ def create_snippet(snippet_params = {}, additional_params = {})
end
describe 'PUT #update' do
let(:project) { create :project }
let(:project) { create :empty_project }
let(:snippet) { create :personal_snippet, author: user, project: project, visibility_level: visibility_level }
def update_snippet(snippet_params = {}, additional_params = {})
......
FactoryGirl.define do
factory :upload do
model { build(:project) }
model { build(:empty_project) }
path { "uploads/-/system/project/avatar/avatar.jpg" }
size 100.kilobytes
uploader "AvatarUploader"
......
......@@ -2,8 +2,8 @@
feature 'Dashboard Projects' do
let(:user) { create(:user) }
let(:project) { create(:project, name: 'awesome stuff') }
let(:project2) { create(:project, :public, name: 'Community project') }
let(:project) { create(:project, :repository, name: 'awesome stuff') }
let(:project2) { create(:empty_project, :public, name: 'Community project') }
before do
project.team << [user, :developer]
......
......@@ -4,7 +4,7 @@
include RepoHelpers
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) }
before do
......
......@@ -2,7 +2,7 @@
describe 'Discussion Comments Merge Request', :js do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) }
before do
......
......@@ -2,7 +2,7 @@
describe 'Markdown References', :js do
let(:user) { create(:user) }
let(:actual_project) { create(:project, :public) }
let(:actual_project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, target_project: actual_project, source_project: actual_project)}
let(:issue_actual_project) { create(:issue, project: actual_project) }
let!(:other_project) { create(:empty_project, :public) }
......
......@@ -3,7 +3,7 @@
feature 'Editing file blob', js: true do
include TreeHelper
let(:project) { create(:project, :public) }
let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, source_branch: 'feature', target_branch: 'master') }
let(:branch) { 'master' }
let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] }
......
......@@ -4,7 +4,7 @@
include RepoHelpers
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
before do
project.add_master(user)
......
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