Commit cf27ede3 authored by Rémy Coutable's avatar Rémy Coutable

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

[EE] Empty project factory by default

See merge request !2585
parents d4b2c53d f81df0d4
...@@ -426,8 +426,6 @@ Here are some things to keep in mind regarding test performance: ...@@ -426,8 +426,6 @@ Here are some things to keep in mind regarding test performance:
- `FactoryGirl.build(...)` and `.build_stubbed` are faster than `.create`. - `FactoryGirl.build(...)` and `.build_stubbed` are faster than `.create`.
- Don't `create` an object when `build`, `build_stubbed`, `attributes_for`, - Don't `create` an object when `build`, `build_stubbed`, `attributes_for`,
`spy`, or `double` will do. Database persistence is slow! `spy`, or `double` will do. Database persistence is slow!
- Use `create(:empty_project)` instead of `create(:project)` when you don't need
the underlying Git repository. Filesystem operations are slow!
- Don't mark a feature as requiring JavaScript (through `@javascript` in - Don't mark a feature as requiring JavaScript (through `@javascript` in
Spinach or `:js` in RSpec) unless it's _actually_ required for the test Spinach or `:js` in RSpec) unless it's _actually_ required for the test
to be valid. Headless browser testing is slow! to be valid. Headless browser testing is slow!
......
...@@ -100,7 +100,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps ...@@ -100,7 +100,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps
group = owned_group group = owned_group
%w(gitlabhq gitlab-ci cookbook-gitlab).each do |path| %w(gitlabhq gitlab-ci cookbook-gitlab).each do |path|
project = create(:empty_project, path: path, group: group) project = create(:project, path: path, group: group)
milestone = create :milestone, title: "Version 7.2", project: project milestone = create :milestone, title: "Version 7.2", project: project
create(:label, project: project, title: 'bug') create(:label, project: project, title: 'bug')
......
...@@ -14,12 +14,12 @@ class Spinach::Features::GroupHooks < Spinach::FeatureSteps ...@@ -14,12 +14,12 @@ class Spinach::Features::GroupHooks < Spinach::FeatureSteps
end end
step 'I own project "Shop" in group "Sourcing"' do step 'I own project "Shop" in group "Sourcing"' do
@project = create(:project, @project = create(:project, :repository,
name: 'Shop', group: @group) name: 'Shop', group: @group)
end end
step 'I own empty project "Empty Shop" in group "Sourcing"' do step 'I own empty project "Empty Shop" in group "Sourcing"' do
@project = create(:empty_project, @project = create(:project,
name: 'Shop', group: @group) name: 'Shop', group: @group)
end end
......
...@@ -15,7 +15,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -15,7 +15,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'Group "Owned" has a public project "Public-project"' do step 'Group "Owned" has a public project "Public-project"' do
group = owned_group group = owned_group
@project = create :empty_project, :public, @project = create :project, :public,
group: group, group: group,
name: "Public-project" name: "Public-project"
end end
...@@ -132,7 +132,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -132,7 +132,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'Group "Owned" has archived project' do step 'Group "Owned" has archived project' do
group = Group.find_by(name: 'Owned') group = Group.find_by(name: 'Owned')
@archived_project = create(:empty_project, :archived, namespace: group, path: "archived-project") @archived_project = create(:project, :archived, namespace: group, path: "archived-project")
end end
step 'I should see "archived" label' do step 'I should see "archived" label' do
......
...@@ -47,11 +47,11 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps ...@@ -47,11 +47,11 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end end
step 'other projects have deploy keys' do step 'other projects have deploy keys' do
@second_project = create(:empty_project, namespace: create(:group)) @second_project = create(:project, namespace: create(:group))
@second_project.team << [current_user, :master] @second_project.team << [current_user, :master]
create(:deploy_keys_project, project: @second_project) create(:deploy_keys_project, project: @second_project)
@third_project = create(:empty_project, namespace: create(:group)) @third_project = create(:project, namespace: create(:group))
@third_project.team << [current_user, :master] @third_project.team << [current_user, :master]
create(:deploy_keys_project, project: @third_project, deploy_key: @second_project.deploy_keys.first) create(:deploy_keys_project, project: @third_project, deploy_key: @second_project.deploy_keys.first)
end end
......
...@@ -16,7 +16,7 @@ class Spinach::Features::ProjectSearch < Spinach::FeatureSteps ...@@ -16,7 +16,7 @@ class Spinach::Features::ProjectSearch < Spinach::FeatureSteps
end end
step 'project has all data available for the search' do step 'project has all data available for the search' do
@project = create :project @project = create :project, :repository
@project.team << [current_user, :master] @project.team << [current_user, :master]
@issue = create :issue, title: 'bla-bla initial', project: @project @issue = create :issue, title: 'bla-bla initial', project: @project
......
...@@ -4,11 +4,11 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps ...@@ -4,11 +4,11 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
include SharedProject include SharedProject
step 'public project "Community"' do step 'public project "Community"' do
create(:empty_project, :public, name: 'Community') create(:project, :public, name: 'Community')
end end
step 'private project "Enterprise"' do step 'private project "Enterprise"' do
create(:empty_project, :private, name: 'Enterprise') create(:project, :private, name: 'Enterprise')
end end
step 'I visit project "Community" page' do step 'I visit project "Community" page' do
......
...@@ -34,7 +34,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -34,7 +34,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end end
step 'I own project "Website"' do step 'I own project "Website"' do
@project = create(:empty_project, name: "Website", namespace: @user.namespace) @project = create(:project, name: "Website", namespace: @user.namespace)
@project.team << [@user, :master] @project.team << [@user, :master]
end end
...@@ -68,7 +68,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps ...@@ -68,7 +68,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
step 'I share project with group "OpenSource"' do step 'I share project with group "OpenSource"' do
project = Project.find_by(name: 'Shop') project = Project.find_by(name: 'Shop')
os_group = create(:group, name: 'OpenSource') os_group = create(:group, name: 'OpenSource')
create(:empty_project, group: os_group) create(:project, group: os_group)
@os_user1 = create(:user) @os_user1 = create(:user)
@os_user2 = create(:user) @os_user2 = create(:user)
os_group.add_owner(@os_user1) os_group.add_owner(@os_user1)
......
...@@ -54,7 +54,7 @@ module SharedProject ...@@ -54,7 +54,7 @@ module SharedProject
# Create an empty project without caring about the name # Create an empty project without caring about the name
step 'I own an empty project' do step 'I own an empty project' do
@project = create(:empty_project, @project = create(:project,
name: 'Empty Project', namespace: @user.namespace) name: 'Empty Project', namespace: @user.namespace)
@project.team << [@user, :master] @project.team << [@user, :master]
end end
...@@ -276,7 +276,7 @@ module SharedProject ...@@ -276,7 +276,7 @@ module SharedProject
def user_owns_project(user_name:, project_name:, visibility: :private) def user_owns_project(user_name:, project_name:, visibility: :private)
user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore) user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore)
project = Project.find_by(name: project_name) project = Project.find_by(name: project_name)
project ||= create(:empty_project, visibility, name: project_name, namespace: user.namespace) project ||= create(:project, visibility, name: project_name, namespace: user.namespace)
project.team << [user, :master] project.team << [user, :master]
end end
end end
...@@ -55,6 +55,6 @@ class Spinach::Features::User < Spinach::FeatureSteps ...@@ -55,6 +55,6 @@ class Spinach::Features::User < Spinach::FeatureSteps
end end
def contributed_project def contributed_project
@contributed_project ||= create(:empty_project, :public) @contributed_project ||= create(:project, :public)
end end
end end
...@@ -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(:empty_project, namespace: group) } let(:project) { create(:project, namespace: group) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:user) { create(:user)} let(:user) { create(:user)}
......
...@@ -29,8 +29,8 @@ describe Admin::DashboardController do ...@@ -29,8 +29,8 @@ describe Admin::DashboardController do
it 'does not retrieve projects that are pending deletion' do it 'does not retrieve projects that are pending deletion' do
sign_in(create(:admin)) sign_in(create(:admin))
project = create(:empty_project) project = create(:project)
pending_delete_project = create(:empty_project, pending_delete: true) pending_delete_project = create(:project, pending_delete: true)
get :index get :index
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Admin::GroupsController do describe Admin::GroupsController do
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:empty_project, namespace: group) } let(:project) { create(:project, namespace: group) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Admin::ProjectsController do describe Admin::ProjectsController do
let!(:project) { create(:empty_project, :public) } let!(:project) { create(:project, :public) }
before do before do
sign_in(create(:admin)) sign_in(create(:admin))
......
...@@ -8,7 +8,7 @@ describe Admin::ServicesController do ...@@ -8,7 +8,7 @@ describe Admin::ServicesController do
end end
describe 'GET #edit' do describe 'GET #edit' do
let!(:project) { create(:empty_project) } let!(:project) { create(:project) }
Service.available_services_names.each do |service_name| Service.available_services_names.each do |service_name|
context "#{service_name}" do context "#{service_name}" do
...@@ -27,7 +27,7 @@ describe Admin::ServicesController do ...@@ -27,7 +27,7 @@ describe Admin::ServicesController do
end end
describe "#update" do describe "#update" do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let!(:service) do let!(:service) do
RedmineService.create( RedmineService.create(
project: project, project: project,
......
...@@ -9,7 +9,7 @@ describe Admin::UsersController do ...@@ -9,7 +9,7 @@ describe Admin::UsersController do
end end
describe 'DELETE #user with projects' do describe 'DELETE #user with projects' do
let(:project) { create(:empty_project, namespace: user.namespace) } let(:project) { create(:project, namespace: user.namespace) }
let!(:issue) { create(:issue, author: user) } let!(:issue) { create(:issue, author: user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe AutocompleteController do describe AutocompleteController do
let!(:project) { create(:empty_project) } let!(:project) { create(:project) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
context 'GET users' do context 'GET users' do
...@@ -105,7 +105,7 @@ describe AutocompleteController do ...@@ -105,7 +105,7 @@ describe AutocompleteController do
end end
context 'non-member login for public project' do context 'non-member login for public project' do
let!(:project) { create(:empty_project, :public) } let!(:project) { create(:project, :public) }
before do before do
sign_in(non_member) sign_in(non_member)
...@@ -167,7 +167,7 @@ describe AutocompleteController do ...@@ -167,7 +167,7 @@ describe AutocompleteController do
end end
context 'unauthenticated user' do context 'unauthenticated user' do
let(:public_project) { create(:empty_project, :public) } let(:public_project) { create(:project, :public) }
let(:body) { JSON.parse(response.body) } let(:body) { JSON.parse(response.body) }
describe 'GET #users with public project' do describe 'GET #users with public project' do
...@@ -271,8 +271,8 @@ describe AutocompleteController do ...@@ -271,8 +271,8 @@ describe AutocompleteController do
end end
context 'GET projects' do context 'GET projects' do
let(:authorized_project) { create(:empty_project) } let(:authorized_project) { create(:project) }
let(:authorized_search_project) { create(:empty_project, name: 'rugged') } let(:authorized_search_project) { create(:project, name: 'rugged') }
before do before do
sign_in(user) sign_in(user)
...@@ -329,8 +329,8 @@ describe AutocompleteController do ...@@ -329,8 +329,8 @@ describe AutocompleteController do
context 'authorized projects apply limit' do context 'authorized projects apply limit' do
before do before do
authorized_project2 = create(:empty_project) authorized_project2 = create(:project)
authorized_project3 = create(:empty_project) authorized_project3 = create(:project)
authorized_project.add_master(user) authorized_project.add_master(user)
authorized_project2.add_master(user) authorized_project2.add_master(user)
...@@ -355,8 +355,8 @@ describe AutocompleteController do ...@@ -355,8 +355,8 @@ describe AutocompleteController do
context 'authorized projects with offset' do context 'authorized projects with offset' do
before do before do
authorized_project2 = create(:empty_project) authorized_project2 = create(:project)
authorized_project3 = create(:empty_project) authorized_project3 = create(:project)
authorized_project.add_master(user) authorized_project.add_master(user)
authorized_project2.add_master(user) authorized_project2.add_master(user)
......
require 'spec_helper' require 'spec_helper'
describe Dashboard::LabelsController do describe Dashboard::LabelsController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:label) { create(:label, project: project) } let!(:label) { create(:label, project: project) }
...@@ -11,7 +11,7 @@ describe Dashboard::LabelsController do ...@@ -11,7 +11,7 @@ describe Dashboard::LabelsController do
end end
describe "#index" do describe "#index" do
let!(:unrelated_label) { create(:label, project: create(:empty_project, :public)) } let!(:unrelated_label) { create(:label, project: create(:project, :public)) }
it 'returns global labels for projects the user has a relationship with' do it 'returns global labels for projects the user has a relationship with' do
get :index, format: :json get :index, format: :json
......
require 'spec_helper' require 'spec_helper'
describe Dashboard::MilestonesController do describe Dashboard::MilestonesController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project_milestone) { create(:milestone, project: project) } let(:project_milestone) { create(:milestone, project: project) }
let(:milestone) do let(:milestone) do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Dashboard::TodosController do describe Dashboard::TodosController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:author) { create(:user) } let(:author) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:todo_service) { TodoService.new } let(:todo_service) { TodoService.new }
before do before do
...@@ -14,7 +14,7 @@ describe Dashboard::TodosController do ...@@ -14,7 +14,7 @@ describe Dashboard::TodosController do
describe 'GET #index' do describe 'GET #index' do
context 'project authorization' do context 'project authorization' do
it 'renders 404 when user does not have read access on given project' do it 'renders 404 when user does not have read access on given project' do
unauthorized_project = create(:empty_project, :private) unauthorized_project = create(:project, :private)
get :index, project_id: unauthorized_project.id get :index, project_id: unauthorized_project.id
...@@ -34,7 +34,7 @@ describe Dashboard::TodosController do ...@@ -34,7 +34,7 @@ describe Dashboard::TodosController do
end end
it 'renders 200 when user has access on given project' do it 'renders 200 when user has access on given project' do
authorized_project = create(:empty_project, :public) authorized_project = create(:project, :public)
get :index, project_id: authorized_project.id get :index, project_id: authorized_project.id
......
...@@ -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(:empty_project) } let(:project) { create(:project) }
before do before do
project.team << [user, :master] project.team << [user, :master]
......
require 'spec_helper' require 'spec_helper'
describe Projects::BoardsController do # rubocop:disable RSpec/FilePath describe Projects::BoardsController do # rubocop:disable RSpec/FilePath
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require('spec_helper') require('spec_helper')
describe ProjectsController do # rubocop:disable RSpec/FilePath describe ProjectsController do # rubocop:disable RSpec/FilePath
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -3,8 +3,8 @@ require 'spec_helper' ...@@ -3,8 +3,8 @@ require 'spec_helper'
describe Explore::ProjectsController do describe Explore::ProjectsController do
describe 'GET #trending' do describe 'GET #trending' do
context 'sorting by update date' do context 'sorting by update date' do
let(:project1) { create(:empty_project, :public, updated_at: 3.days.ago) } let(:project1) { create(:project, :public, updated_at: 3.days.ago) }
let(:project2) { create(:empty_project, :public, updated_at: 1.day.ago) } let(:project2) { create(:project, :public, updated_at: 1.day.ago) }
before do before do
create(:trending_project, project: project1) create(:trending_project, project: project1)
......
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
describe Groups::MilestonesController do describe Groups::MilestonesController do
let(:group) { create(:group) } let(:group) { create(:group) }
let!(:project) { create(:empty_project, group: group) } let!(:project) { create(:project, group: group) }
let!(:project2) { create(:empty_project, group: group) } let!(:project2) { create(:project, group: group) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:title) { '肯定不是中文的问题' } let(:title) { '肯定不是中文的问题' }
let(:milestone) do let(:milestone) do
......
...@@ -3,7 +3,7 @@ require 'rails_helper' ...@@ -3,7 +3,7 @@ require 'rails_helper'
describe GroupsController do describe GroupsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:group) { create(:group, :public) } let(:group) { create(:group, :public) }
let(:project) { create(:empty_project, namespace: group) } let(:project) { create(:project, namespace: group) }
let!(:group_member) { create(:group_member, group: group, user: user) } let!(:group_member) { create(:group_member, group: group, user: user) }
describe 'GET #index' do describe 'GET #index' do
......
...@@ -52,7 +52,7 @@ describe Import::BitbucketController do ...@@ -52,7 +52,7 @@ describe Import::BitbucketController do
end end
it "assigns variables" do it "assigns variables" do
@project = create(:empty_project, import_type: 'bitbucket', creator_id: user.id) @project = create(:project, import_type: 'bitbucket', creator_id: user.id)
allow_any_instance_of(Bitbucket::Client).to receive(:repos).and_return([@repo]) allow_any_instance_of(Bitbucket::Client).to receive(:repos).and_return([@repo])
get :status get :status
...@@ -63,7 +63,7 @@ describe Import::BitbucketController do ...@@ -63,7 +63,7 @@ describe Import::BitbucketController do
end end
it "does not show already added project" do it "does not show already added project" do
@project = create(:empty_project, import_type: 'bitbucket', creator_id: user.id, import_source: 'asd/vim') @project = create(:project, import_type: 'bitbucket', creator_id: user.id, import_source: 'asd/vim')
allow_any_instance_of(Bitbucket::Client).to receive(:repos).and_return([@repo]) allow_any_instance_of(Bitbucket::Client).to receive(:repos).and_return([@repo])
get :status get :status
......
...@@ -16,7 +16,7 @@ describe Import::FogbugzController do ...@@ -16,7 +16,7 @@ describe Import::FogbugzController do
end end
it 'assigns variables' do it 'assigns variables' do
@project = create(:empty_project, import_type: 'fogbugz', creator_id: user.id) @project = create(:project, import_type: 'fogbugz', creator_id: user.id)
stub_client(repos: [@repo]) stub_client(repos: [@repo])
get :status get :status
...@@ -26,7 +26,7 @@ describe Import::FogbugzController do ...@@ -26,7 +26,7 @@ describe Import::FogbugzController do
end end
it 'does not show already added project' do it 'does not show already added project' do
@project = create(:empty_project, import_type: 'fogbugz', creator_id: user.id, import_source: 'vim') @project = create(:project, import_type: 'fogbugz', creator_id: user.id, import_source: 'vim')
stub_client(repos: [@repo]) stub_client(repos: [@repo])
get :status get :status
......
...@@ -36,7 +36,7 @@ describe Import::GitlabController do ...@@ -36,7 +36,7 @@ describe Import::GitlabController do
end end
it "assigns variables" do it "assigns variables" do
@project = create(:empty_project, import_type: 'gitlab', creator_id: user.id) @project = create(:project, import_type: 'gitlab', creator_id: user.id)
stub_client(projects: [@repo]) stub_client(projects: [@repo])
get :status get :status
...@@ -46,7 +46,7 @@ describe Import::GitlabController do ...@@ -46,7 +46,7 @@ describe Import::GitlabController do
end end
it "does not show already added project" do it "does not show already added project" do
@project = create(:empty_project, import_type: 'gitlab', creator_id: user.id, import_source: 'asd/vim') @project = create(:project, import_type: 'gitlab', creator_id: user.id, import_source: 'asd/vim')
stub_client(projects: [@repo]) stub_client(projects: [@repo])
get :status get :status
......
...@@ -27,7 +27,7 @@ describe Import::GoogleCodeController do ...@@ -27,7 +27,7 @@ describe Import::GoogleCodeController do
end end
it "assigns variables" do it "assigns variables" do
@project = create(:empty_project, import_type: 'google_code', creator_id: user.id) @project = create(:project, import_type: 'google_code', creator_id: user.id)
stub_client(repos: [@repo], incompatible_repos: []) stub_client(repos: [@repo], incompatible_repos: [])
get :status get :status
...@@ -38,7 +38,7 @@ describe Import::GoogleCodeController do ...@@ -38,7 +38,7 @@ describe Import::GoogleCodeController do
end end
it "does not show already added project" do it "does not show already added project" do
@project = create(:empty_project, import_type: 'google_code', creator_id: user.id, import_source: 'vim') @project = create(:project, import_type: 'google_code', creator_id: user.id, import_source: 'vim')
stub_client(repos: [@repo], incompatible_repos: []) stub_client(repos: [@repo], incompatible_repos: [])
get :status get :status
......
require 'spec_helper' require 'spec_helper'
describe NotificationSettingsController do describe NotificationSettingsController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:group) { create(:group, :internal) } let(:group) { create(:group, :internal) }
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -99,7 +99,7 @@ describe NotificationSettingsController do ...@@ -99,7 +99,7 @@ describe NotificationSettingsController do
end end
context 'not authorized' do context 'not authorized' do
let(:private_project) { create(:empty_project, :private) } let(:private_project) { create(:project, :private) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -3,7 +3,7 @@ require 'rails_helper' ...@@ -3,7 +3,7 @@ require 'rails_helper'
describe Projects::ApproverGroupsController do describe Projects::ApproverGroupsController do
describe '#destroy' do describe '#destroy' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
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 'rails_helper' ...@@ -3,7 +3,7 @@ require 'rails_helper'
describe Projects::ApproversController do describe Projects::ApproversController do
describe '#destroy' do describe '#destroy' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::AvatarsController do describe Projects::AvatarsController do
let(:project) { create(:empty_project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) } let(:project) { create(:project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -193,7 +193,7 @@ describe Projects::BlobController do ...@@ -193,7 +193,7 @@ describe Projects::BlobController do
context "when user doesn't have access" do context "when user doesn't have access" do
before do before do
other_project = create(:empty_project) other_project = create(:project, :repository)
merge_request.update!(source_project: other_project, target_project: other_project) merge_request.update!(source_project: other_project, target_project: other_project)
end end
......
require 'spec_helper' require 'spec_helper'
describe Projects::Boards::IssuesController do describe Projects::Boards::IssuesController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:board) { create(:board, project: project) } let(:board) { create(:board, project: project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:guest) { create(:user) } let(:guest) { create(:user) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::Boards::ListsController do describe Projects::Boards::ListsController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:board) { create(:board, project: project) } let(:board) { create(:board, project: project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:guest) { create(:user) } let(:guest) { create(:user) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::BoardsController do describe Projects::BoardsController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -96,7 +96,7 @@ describe Projects::BranchesController do ...@@ -96,7 +96,7 @@ describe Projects::BranchesController do
end end
context 'repository-less project' do context 'repository-less project' do
let(:project) { create :empty_project } let(:project) { create :project }
it 'redirects to newly created branch' do it 'redirects to newly created branch' do
result = { status: :success, branch: double(name: branch) } result = { status: :success, branch: double(name: branch) }
......
...@@ -24,8 +24,8 @@ describe Projects::DeployKeysController do ...@@ -24,8 +24,8 @@ describe Projects::DeployKeysController do
end end
context 'when json requested' do context 'when json requested' do
let(:project2) { create(:empty_project, :internal)} let(:project2) { create(:project, :internal)}
let(:project_private) { create(:empty_project, :private)} let(:project_private) { create(:project, :private)}
let(:deploy_key_internal) do let(:deploy_key_internal) do
create(:deploy_key, key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCdMHEHyhRjbhEZVddFn6lTWdgEy5Q6Bz4nwGB76xWZI5YT/1WJOMEW+sL5zYd31kk7sd3FJ5L9ft8zWMWrr/iWXQikC2cqZK24H1xy+ZUmrRuJD4qGAaIVoyyzBL+avL+lF8J5lg6YSw8gwJY/lX64/vnJHUlWw2n5BF8IFOWhiw== dummy@gitlab.com') create(:deploy_key, key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCdMHEHyhRjbhEZVddFn6lTWdgEy5Q6Bz4nwGB76xWZI5YT/1WJOMEW+sL5zYd31kk7sd3FJ5L9ft8zWMWrr/iWXQikC2cqZK24H1xy+ZUmrRuJD4qGAaIVoyyzBL+avL+lF8J5lg6YSw8gwJY/lX64/vnJHUlWw2n5BF8IFOWhiw== dummy@gitlab.com')
......
...@@ -4,7 +4,7 @@ describe Projects::DeploymentsController do ...@@ -4,7 +4,7 @@ describe Projects::DeploymentsController do
include ApiHelpers include ApiHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:environment) { create(:environment, name: 'production', project: project) } let(:environment) { create(:environment, name: 'production', project: project) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::EnvironmentsController do describe Projects::EnvironmentsController do
set(:user) { create(:user) } set(:user) { create(:user) }
set(:project) { create(:empty_project) } set(:project) { create(:project) }
set(:environment) do set(:environment) do
create(:environment, name: 'production', project: project) create(:environment, name: 'production', project: project)
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::GroupLinksController do describe Projects::GroupLinksController do
let(:group) { create(:group, :private) } let(:group) { create(:group, :private) }
let(:group2) { create(:group, :private) } let(:group2) { create(:group, :private) }
let(:project) { create(:empty_project, :private, group: group2) } let(:project) { create(:project, :private, group: group2) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::HooksController do describe Projects::HooksController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::ImportsController do describe Projects::ImportsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -78,7 +78,7 @@ describe Projects::IssuesController do ...@@ -78,7 +78,7 @@ describe Projects::IssuesController do
end end
describe 'issue weights' do describe 'issue weights' do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:issue) { create(:issue, project: project, weight: 5) } let(:issue) { create(:issue, project: project, weight: 5) }
let(:issue2) { create(:issue, project: project, weight: 1) } let(:issue2) { create(:issue, project: project, weight: 1) }
......
...@@ -234,7 +234,7 @@ describe Projects::IssuesController do ...@@ -234,7 +234,7 @@ describe Projects::IssuesController do
end end
context 'when moving issue to another private project' do context 'when moving issue to another private project' do
let(:another_project) { create(:empty_project, :private) } let(:another_project) { create(:project, :private) }
context 'when user has access to move issue' do context 'when user has access to move issue' do
before do before do
...@@ -594,7 +594,7 @@ describe Projects::IssuesController do ...@@ -594,7 +594,7 @@ describe Projects::IssuesController do
describe 'POST #create' do describe 'POST #create' do
def post_new_issue(issue_attrs = {}, additional_params = {}) def post_new_issue(issue_attrs = {}, additional_params = {})
sign_in(user) sign_in(user)
project = create(:empty_project, :public) project = create(:project, :public)
project.team << [user, :developer] project.team << [user, :developer]
post :create, { post :create, {
...@@ -817,7 +817,7 @@ describe Projects::IssuesController do ...@@ -817,7 +817,7 @@ describe Projects::IssuesController 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(:empty_project, namespace: namespace) } let(:project) { create(:project, namespace: namespace) }
before do before do
sign_in(owner) sign_in(owner)
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::JobsController do describe Projects::JobsController do
include ApiHelpers include ApiHelpers
let(:project) { create(:empty_project, :public) } let(:project) { create(:project, :public) }
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:user) { create(:user) } let(:user) { create(:user) }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::LabelsController do describe Projects::LabelsController do
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:empty_project, namespace: group) } let(:project) { create(:project, namespace: group) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
...@@ -73,7 +73,7 @@ describe Projects::LabelsController do ...@@ -73,7 +73,7 @@ describe Projects::LabelsController do
describe 'POST #generate' do describe 'POST #generate' do
context 'personal project' do context 'personal project' do
let(:personal_project) { create(:empty_project, namespace: user.namespace) } let(:personal_project) { create(:project, namespace: user.namespace) }
it 'creates labels' do it 'creates labels' do
post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project
......
require 'spec_helper' require 'spec_helper'
describe Projects::MattermostsController do describe Projects::MattermostsController do
let!(:project) { create(:empty_project) } let!(:project) { create(:project) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
before do before do
......
...@@ -80,7 +80,7 @@ describe Projects::MergeRequests::CreationsController do ...@@ -80,7 +80,7 @@ describe Projects::MergeRequests::CreationsController do
context 'when the target project is a fork of a deleted project' do context 'when the target project is a fork of a deleted project' do
before do before do
original_project = create(:empty_project) original_project = create(:project)
project.update_attributes(forked_from_project: original_project, approvals_before_merge: 4) project.update_attributes(forked_from_project: original_project, approvals_before_merge: 4)
original_project.update_attributes(pending_delete: true) original_project.update_attributes(pending_delete: true)
......
...@@ -145,7 +145,7 @@ describe Projects::MergeRequests::DiffsController do ...@@ -145,7 +145,7 @@ describe Projects::MergeRequests::DiffsController do
end end
context 'when the merge request belongs to a different project' do context 'when the merge request belongs to a different project' do
let(:other_project) { create(:empty_project) } let(:other_project) { create(:project) }
before do before do
other_project.team << [user, :master] other_project.team << [user, :master]
......
require 'spec_helper' require 'spec_helper'
describe Projects::MilestonesController do describe Projects::MilestonesController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:milestone) { create(:milestone, project: project) } let(:milestone) { create(:milestone, project: project) }
let(:issue) { create(:issue, project: project, milestone: milestone) } let(:issue) { create(:issue, project: project, milestone: milestone) }
......
...@@ -95,7 +95,7 @@ describe Projects::MirrorsController do ...@@ -95,7 +95,7 @@ describe Projects::MirrorsController do
end end
context 'when project does not have a mirror' do context 'when project does not have a mirror' do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
it 'allows to create a mirror' do it 'allows to create a mirror' do
expect_any_instance_of(EE::Project).to receive(:force_import_job!) expect_any_instance_of(EE::Project).to receive(:force_import_job!)
...@@ -107,7 +107,7 @@ describe Projects::MirrorsController do ...@@ -107,7 +107,7 @@ describe Projects::MirrorsController do
end end
context 'when project has a mirror' do context 'when project has a mirror' do
let(:project) { create(:empty_project, :mirror, :import_finished) } let(:project) { create(:project, :mirror, :import_finished) }
it 'is able to disable the mirror' do it 'is able to disable the mirror' do
expect { do_put(project, mirror: false) }.to change { Project.mirror.count }.to(0) expect { do_put(project, mirror: false) }.to change { Project.mirror.count }.to(0)
...@@ -119,7 +119,7 @@ describe Projects::MirrorsController do ...@@ -119,7 +119,7 @@ describe Projects::MirrorsController do
it 'forces update' do it 'forces update' do
expect_any_instance_of(EE::Project).to receive(:force_import_job!) expect_any_instance_of(EE::Project).to receive(:force_import_job!)
project = create(:empty_project, :mirror) project = create(:project, :mirror)
sign_in(project.owner) sign_in(project.owner)
put :update_now, { namespace_id: project.namespace.to_param, project_id: project.to_param } put :update_now, { namespace_id: project.namespace.to_param, project_id: project.to_param }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::NotesController do describe Projects::NotesController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let(:note) { create(:note, noteable: issue, project: project) } let(:note) { create(:note, noteable: issue, project: project) }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::PagesController do describe Projects::PagesController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project, :public, :access_requestable) } let(:project) { create(:project, :public, :access_requestable) }
let(:request_params) do let(:request_params) do
{ {
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::PagesDomainsController do describe Projects::PagesDomainsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let!(:pages_domain) { create(:pages_domain, project: project) } let!(:pages_domain) { create(:pages_domain, project: project) }
let(:request_params) do let(:request_params) do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::PipelineSchedulesController do describe Projects::PipelineSchedulesController do
include AccessMatchersForController include AccessMatchersForController
set(:project) { create(:empty_project, :public) } set(:project) { create(:project, :public) }
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project) } let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project) }
describe 'GET #index' do describe 'GET #index' do
......
...@@ -4,7 +4,7 @@ describe Projects::PipelinesController do ...@@ -4,7 +4,7 @@ describe Projects::PipelinesController do
include ApiHelpers include ApiHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project, :public) } let(:project) { create(:project, :public) }
let(:feature) { ProjectFeature::DISABLED } let(:feature) { ProjectFeature::DISABLED }
before do before do
......
...@@ -2,7 +2,7 @@ require('spec_helper') ...@@ -2,7 +2,7 @@ require('spec_helper')
describe Projects::ProjectMembersController do describe Projects::ProjectMembersController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project, :public, :access_requestable) } let(:project) { create(:project, :public, :access_requestable) }
describe 'GET index' do describe 'GET index' do
it 'should have the project_members address with a 200 status code' do it 'should have the project_members address with a 200 status code' do
...@@ -158,7 +158,7 @@ describe Projects::ProjectMembersController do ...@@ -158,7 +158,7 @@ describe Projects::ProjectMembersController do
end end
context 'and is an owner' do context 'and is an owner' do
let(:project) { create(:empty_project, namespace: user.namespace) } let(:project) { create(:project, namespace: user.namespace) }
before do before do
project.team << [user, :master] project.team << [user, :master]
...@@ -261,7 +261,7 @@ describe Projects::ProjectMembersController do ...@@ -261,7 +261,7 @@ describe Projects::ProjectMembersController do
end end
describe 'POST apply_import' do describe 'POST apply_import' do
let(:another_project) { create(:empty_project, :private) } let(:another_project) { create(:project, :private) }
let(:member) { create(:user) } let(:member) { create(:user) }
before do before do
......
...@@ -2,7 +2,7 @@ require('spec_helper') ...@@ -2,7 +2,7 @@ require('spec_helper')
describe Projects::PrometheusController do describe Projects::PrometheusController do
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:project) { create(:empty_project) } let!(:project) { create(:project) }
let(:prometheus_service) { double('prometheus_service') } let(:prometheus_service) { double('prometheus_service') }
......
require 'spec_helper' require 'spec_helper'
describe Projects::PushRulesController do describe Projects::PushRulesController do
let(:project) { create(:empty_project, push_rule: create(:push_rule, prevent_secrets: false)) } let(:project) { create(:project, push_rule: create(:push_rule, prevent_secrets: false)) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::Registry::RepositoriesController do describe Projects::Registry::RepositoriesController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project, :private) } let(:project) { create(:project, :private) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::Registry::TagsController do describe Projects::Registry::TagsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project, :private) } let(:project) { create(:project, :private) }
before do before do
sign_in(user) sign_in(user)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::RunnersController do describe Projects::RunnersController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:runner) { create(:ci_runner) } let(:runner) { create(:ci_runner) }
let(:params) do let(:params) do
......
...@@ -28,7 +28,7 @@ describe Projects::ServicesController do ...@@ -28,7 +28,7 @@ describe Projects::ServicesController do
context 'success' do context 'success' do
context 'with empty project' do context 'with empty project' do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
context 'with chat notification service' do context 'with chat notification service' do
let(:service) { project.create_microsoft_teams_service(webhook: 'http://webhook.com') } let(:service) { project.create_microsoft_teams_service(webhook: 'http://webhook.com') }
......
require('spec_helper') require('spec_helper')
describe Projects::Settings::CiCdController do describe Projects::Settings::CiCdController do
let(:project) { create(:empty_project, :public, :access_requestable) } let(:project) { create(:project, :public, :access_requestable) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::Settings::IntegrationsController do describe Projects::Settings::IntegrationsController do
let(:namespace) { create(:group, :private) } let(:namespace) { create(:group, :private) }
let(:project) { create(:empty_project, :private, namespace: namespace) } let(:project) { create(:project, :private, namespace: namespace) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::Settings::SlacksController do describe Projects::Settings::SlacksController do
let(:project) { create(:empty_project, :public) } let(:project) { create(:project, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -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 :empty_project, :public } let(:project) { create :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 = {})
......
...@@ -2,7 +2,7 @@ require('spec_helper') ...@@ -2,7 +2,7 @@ require('spec_helper')
describe Projects::TodosController do describe Projects::TodosController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
......
require('spec_helper') require('spec_helper')
describe Projects::UploadsController do describe Projects::UploadsController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') } let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') }
let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') } let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') }
......
require 'spec_helper' require 'spec_helper'
describe Projects::VariablesController do describe Projects::VariablesController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require('spec_helper') require('spec_helper')
describe ProjectsController do describe ProjectsController do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:public_project) { create(:empty_project, :public) } let(:public_project) { create(:project, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') } let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') }
let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') } let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') }
...@@ -34,7 +34,7 @@ describe ProjectsController do ...@@ -34,7 +34,7 @@ describe ProjectsController do
end end
context "user does not have access to project" do context "user does not have access to project" do
let(:private_project) { create(:empty_project, :private) } let(:private_project) { create(:project, :private) }
it "does not initialize notification setting" do it "does not initialize notification setting" do
get :show, namespace_id: private_project.namespace, id: private_project get :show, namespace_id: private_project.namespace, id: private_project
...@@ -199,7 +199,7 @@ describe ProjectsController do ...@@ -199,7 +199,7 @@ describe ProjectsController do
end end
context "when the url contains .atom" do context "when the url contains .atom" do
let(:public_project_with_dot_atom) { build(:empty_project, :public, name: 'my.atom', path: 'my.atom') } let(:public_project_with_dot_atom) { build(:project, :public, name: 'my.atom', path: 'my.atom') }
it 'expects an error creating the project' do it 'expects an error creating the project' do
expect(public_project_with_dot_atom).not_to be_valid expect(public_project_with_dot_atom).not_to be_valid
...@@ -208,7 +208,7 @@ describe ProjectsController do ...@@ -208,7 +208,7 @@ describe ProjectsController do
context 'when the project is pending deletions' do context 'when the project is pending deletions' do
it 'renders a 404 error' do it 'renders a 404 error' do
project = create(:empty_project, pending_delete: true) project = create(:project, pending_delete: true)
sign_in(user) sign_in(user)
get :show, namespace_id: project.namespace, id: project get :show, namespace_id: project.namespace, id: project
...@@ -219,7 +219,7 @@ describe ProjectsController do ...@@ -219,7 +219,7 @@ describe ProjectsController do
context "redirection from http://someproject.git" do context "redirection from http://someproject.git" do
it 'redirects to project page (format.html)' do it 'redirects to project page (format.html)' do
project = create(:empty_project, :public) project = create(:project, :public)
get :show, namespace_id: project.namespace, id: project, format: :git get :show, namespace_id: project.namespace, id: project, format: :git
...@@ -431,7 +431,7 @@ describe ProjectsController do ...@@ -431,7 +431,7 @@ describe ProjectsController do
end end
context 'when project not forked' do context 'when project not forked' do
let(:unforked_project) { create(:empty_project, namespace: user.namespace) } let(:unforked_project) { create(: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,
......
...@@ -8,7 +8,7 @@ describe SearchController do ...@@ -8,7 +8,7 @@ describe SearchController do
end end
it 'finds issue comments' do it 'finds issue comments' do
project = create(:empty_project, :public) project = create(:project, :public)
note = create(:note_on_issue, project: project) note = create(:note_on_issue, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note get :show, project_id: project.id, scope: 'notes', search: note.note
...@@ -23,7 +23,7 @@ describe SearchController do ...@@ -23,7 +23,7 @@ describe SearchController do
end end
it "doesn't expose comments on issues" do it "doesn't expose comments on issues" do
project = create(:empty_project, :public, :issues_private) project = create(:project, :public, :issues_private)
note = create(:note_on_issue, project: project) note = create(:note_on_issue, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note get :show, project_id: project.id, scope: 'notes', search: note.note
...@@ -33,7 +33,7 @@ describe SearchController do ...@@ -33,7 +33,7 @@ describe SearchController do
end end
it "doesn't expose comments on merge_requests" do it "doesn't expose comments on merge_requests" do
project = create(:empty_project, :public, :merge_requests_private) project = create(:project, :public, :merge_requests_private)
note = create(:note_on_merge_request, project: project) note = create(:note_on_merge_request, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note get :show, project_id: project.id, scope: 'notes', search: note.note
...@@ -42,7 +42,7 @@ describe SearchController do ...@@ -42,7 +42,7 @@ describe SearchController do
end end
it "doesn't expose comments on snippets" do it "doesn't expose comments on snippets" do
project = create(:empty_project, :public, :snippets_private) project = create(:project, :public, :snippets_private)
note = create(:note_on_project_snippet, project: project) note = create(:note_on_project_snippet, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note get :show, project_id: project.id, scope: 'notes', search: note.note
......
...@@ -2,7 +2,7 @@ require 'rails_helper' ...@@ -2,7 +2,7 @@ require 'rails_helper'
describe SentNotificationsController do describe SentNotificationsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:sent_notification) { create(:sent_notification, project: project, noteable: issue, recipient: user) } let(:sent_notification) { create(:sent_notification, project: project, noteable: issue, recipient: user) }
let(:issue) do let(:issue) do
......
...@@ -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 :empty_project } let(:project) { create :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 = {})
......
...@@ -131,7 +131,7 @@ describe UploadsController do ...@@ -131,7 +131,7 @@ describe UploadsController do
describe "GET show" do describe "GET show" do
context 'Content-Disposition security measures' do context 'Content-Disposition security measures' do
let(:project) { create(:empty_project, :public) } let(:project) { create(:project, :public) }
context 'for PNG files' do context 'for PNG files' do
it 'returns Content-Disposition: inline' do it 'returns Content-Disposition: inline' do
...@@ -203,7 +203,7 @@ describe UploadsController do ...@@ -203,7 +203,7 @@ describe UploadsController do
end end
context "when viewing a project avatar" do context "when viewing a project avatar" do
let!(:project) { create(:empty_project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) } let!(:project) { create(:project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) }
context "when the project is public" do context "when the project is public" do
before do before do
......
...@@ -86,7 +86,7 @@ describe UsersController do ...@@ -86,7 +86,7 @@ describe UsersController do
end end
context 'forked project' do context 'forked project' do
let(:project) { create(:empty_project) } let(:project) { create(:project) }
let(:forked_project) { Projects::ForkService.new(project, user).execute } let(:forked_project) { Projects::ForkService.new(project, user).execute }
before do before do
...@@ -104,7 +104,7 @@ describe UsersController do ...@@ -104,7 +104,7 @@ describe UsersController do
end end
describe 'GET #calendar_activities' do describe 'GET #calendar_activities' do
let!(:project) { create(:empty_project) } let!(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -8,7 +8,7 @@ FactoryGirl.define do ...@@ -8,7 +8,7 @@ FactoryGirl.define do
trait :project_event do trait :project_event do
entity_type 'Project' entity_type 'Project'
entity_id { create(:empty_project).id } entity_id { create(:project).id }
end end
trait :group_event do trait :group_event do
......
FactoryGirl.define do FactoryGirl.define do
factory :board do factory :board do
sequence(:name) { |n| "board#{n}" } sequence(:name) { |n| "board#{n}" }
project factory: :empty_project project
after(:create) do |board| after(:create) do |board|
board.lists.create(list_type: :closed) board.lists.create(list_type: :closed)
......
...@@ -5,7 +5,7 @@ FactoryGirl.define do ...@@ -5,7 +5,7 @@ FactoryGirl.define do
ref 'master' ref 'master'
active true active true
description "pipeline schedule" description "pipeline schedule"
project factory: :empty_project project
trait :nightly do trait :nightly do
cron '0 1 * * *' cron '0 1 * * *'
......
...@@ -5,7 +5,7 @@ FactoryGirl.define do ...@@ -5,7 +5,7 @@ FactoryGirl.define do
sha '97de212e80737a608d939f648d959671fb0a0142' sha '97de212e80737a608d939f648d959671fb0a0142'
status 'pending' status 'pending'
project factory: :empty_project project
factory :ci_pipeline_without_jobs do factory :ci_pipeline_without_jobs do
after(:build) do |pipeline| after(:build) do |pipeline|
......
FactoryGirl.define do FactoryGirl.define do
factory :ci_runner_project, class: Ci::RunnerProject do factory :ci_runner_project, class: Ci::RunnerProject do
runner factory: :ci_runner runner factory: :ci_runner
project factory: :empty_project project
end end
end end
...@@ -7,6 +7,6 @@ FactoryGirl.define do ...@@ -7,6 +7,6 @@ FactoryGirl.define do
protected true protected true
end end
project factory: :empty_project project
end end
end end
...@@ -3,7 +3,7 @@ require_relative '../support/repo_helpers' ...@@ -3,7 +3,7 @@ require_relative '../support/repo_helpers'
FactoryGirl.define do FactoryGirl.define do
factory :commit do factory :commit do
git_commit RepoHelpers.sample_commit git_commit RepoHelpers.sample_commit
project factory: :empty_project project
initialize_with do initialize_with do
new(git_commit, project) new(git_commit, project)
......
FactoryGirl.define do FactoryGirl.define do
factory :deploy_keys_project do factory :deploy_keys_project do
deploy_key deploy_key
project factory: :empty_project project
end end
end end
...@@ -2,12 +2,10 @@ FactoryGirl.define do ...@@ -2,12 +2,10 @@ FactoryGirl.define do
factory :environment, class: Environment do factory :environment, class: Environment do
sequence(:name) { |n| "environment#{n}" } sequence(:name) { |n| "environment#{n}" }
project factory: :empty_project association :project, :repository
sequence(:external_url) { |n| "https://env#{n}.example.gitlab.com" } sequence(:external_url) { |n| "https://env#{n}.example.gitlab.com" }
trait :with_review_app do |environment| trait :with_review_app do |environment|
project
transient do transient do
ref 'master' ref 'master'
end end
......
FactoryGirl.define do FactoryGirl.define do
factory :event do factory :event do
project factory: :empty_project project
author factory: :user author factory: :user
trait(:created) { action Event::CREATED } trait(:created) { action Event::CREATED }
......
...@@ -2,7 +2,7 @@ FactoryGirl.define do ...@@ -2,7 +2,7 @@ FactoryGirl.define do
factory :file_uploader do factory :file_uploader do
skip_create skip_create
project factory: :empty_project project
secret nil secret nil
transient do transient do
......
FactoryGirl.define do FactoryGirl.define do
factory :forked_project_link do factory :forked_project_link do
association :forked_to_project, factory: :project association :forked_to_project, factory: [:project, :repository]
association :forked_from_project, factory: :project association :forked_from_project, factory: [:project, :repository]
after(:create) do |link| after(:create) do |link|
link.forked_from_project.reload link.forked_from_project.reload
...@@ -9,7 +9,7 @@ FactoryGirl.define do ...@@ -9,7 +9,7 @@ FactoryGirl.define do
end end
trait :forked_to_empty_project do trait :forked_to_empty_project do
association :forked_to_project, factory: :empty_project association :forked_to_project, factory: :project
end end
end end
end end
...@@ -7,6 +7,6 @@ FactoryGirl.define do ...@@ -7,6 +7,6 @@ FactoryGirl.define do
source 0 source 0
branches_affected 0 branches_affected 0
tags_affected 0 tags_affected 0
project factory: :empty_project project
end end
end end
FactoryGirl.define do FactoryGirl.define do
factory :geo_project_registry, class: Geo::ProjectRegistry do factory :geo_project_registry, class: Geo::ProjectRegistry do
project factory: :empty_project project
last_repository_synced_at nil last_repository_synced_at nil
last_repository_successful_sync_at nil last_repository_successful_sync_at nil
last_wiki_synced_at nil last_wiki_synced_at nil
......
...@@ -2,7 +2,7 @@ FactoryGirl.define do ...@@ -2,7 +2,7 @@ FactoryGirl.define do
factory :issue do factory :issue do
title { generate(:title) } title { generate(:title) }
author author
project factory: :empty_project project
trait :confidential do trait :confidential do
confidential true confidential true
......
FactoryGirl.define do FactoryGirl.define do
factory :label_priority do factory :label_priority do
project factory: :empty_project project
label label
sequence(:priority) sequence(:priority)
end end
......
...@@ -5,7 +5,7 @@ FactoryGirl.define do ...@@ -5,7 +5,7 @@ FactoryGirl.define do
end end
factory :label, traits: [:base_label], class: ProjectLabel do factory :label, traits: [:base_label], class: ProjectLabel do
project factory: :empty_project project
transient do transient do
priority nil priority nil
......
...@@ -27,7 +27,7 @@ FactoryGirl.define do ...@@ -27,7 +27,7 @@ FactoryGirl.define do
elsif evaluator.project_id elsif evaluator.project_id
milestone.project_id = evaluator.project_id milestone.project_id = evaluator.project_id
else else
milestone.project = create(:empty_project) milestone.project = create(:project)
end end
end end
......
...@@ -4,7 +4,7 @@ include ActionDispatch::TestProcess ...@@ -4,7 +4,7 @@ include ActionDispatch::TestProcess
FactoryGirl.define do FactoryGirl.define do
factory :note do factory :note do
project factory: :empty_project project
note { generate(:title) } note { generate(:title) }
author author
on_issue on_issue
......
FactoryGirl.define do FactoryGirl.define do
factory :notification_setting do factory :notification_setting do
source factory: :empty_project source factory: :project
user user
level 3 level 3
events [] events []
......
FactoryGirl.define do FactoryGirl.define do
factory :project_group_link do factory :project_group_link do
project factory: :empty_project project
group group
end end
end end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment