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:
- `FactoryGirl.build(...)` and `.build_stubbed` are faster than `.create`.
- Don't `create` an object when `build`, `build_stubbed`, `attributes_for`,
`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
Spinach or `:js` in RSpec) unless it's _actually_ required for the test
to be valid. Headless browser testing is slow!
......
......@@ -100,7 +100,7 @@ class Spinach::Features::GroupMilestones < Spinach::FeatureSteps
group = owned_group
%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
create(:label, project: project, title: 'bug')
......
......@@ -14,12 +14,12 @@ class Spinach::Features::GroupHooks < Spinach::FeatureSteps
end
step 'I own project "Shop" in group "Sourcing"' do
@project = create(:project,
@project = create(:project, :repository,
name: 'Shop', group: @group)
end
step 'I own empty project "Empty Shop" in group "Sourcing"' do
@project = create(:empty_project,
@project = create(:project,
name: 'Shop', group: @group)
end
......
......@@ -15,7 +15,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'Group "Owned" has a public project "Public-project"' do
group = owned_group
@project = create :empty_project, :public,
@project = create :project, :public,
group: group,
name: "Public-project"
end
......@@ -132,7 +132,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
step 'Group "Owned" has archived project' do
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
step 'I should see "archived" label' do
......
......@@ -47,11 +47,11 @@ class Spinach::Features::ProjectDeployKeys < Spinach::FeatureSteps
end
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]
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]
create(:deploy_keys_project, project: @third_project, deploy_key: @second_project.deploy_keys.first)
end
......
......@@ -16,7 +16,7 @@ class Spinach::Features::ProjectSearch < Spinach::FeatureSteps
end
step 'project has all data available for the search' do
@project = create :project
@project = create :project, :repository
@project.team << [current_user, :master]
@issue = create :issue, title: 'bla-bla initial', project: @project
......
......@@ -4,11 +4,11 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
include SharedProject
step 'public project "Community"' do
create(:empty_project, :public, name: 'Community')
create(:project, :public, name: 'Community')
end
step 'private project "Enterprise"' do
create(:empty_project, :private, name: 'Enterprise')
create(:project, :private, name: 'Enterprise')
end
step 'I visit project "Community" page' do
......
......@@ -34,7 +34,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
end
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]
end
......@@ -68,7 +68,7 @@ class Spinach::Features::ProjectTeamManagement < Spinach::FeatureSteps
step 'I share project with group "OpenSource"' do
project = Project.find_by(name: 'Shop')
os_group = create(:group, name: 'OpenSource')
create(:empty_project, group: os_group)
create(:project, group: os_group)
@os_user1 = create(:user)
@os_user2 = create(:user)
os_group.add_owner(@os_user1)
......
......@@ -54,7 +54,7 @@ module SharedProject
# Create an empty project without caring about the name
step 'I own an empty project' do
@project = create(:empty_project,
@project = create(:project,
name: 'Empty Project', namespace: @user.namespace)
@project.team << [@user, :master]
end
......@@ -276,7 +276,7 @@ module SharedProject
def user_owns_project(user_name:, project_name:, visibility: :private)
user = user_exists(user_name, username: user_name.gsub(/\s/, '').underscore)
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]
end
end
......@@ -55,6 +55,6 @@ class Spinach::Features::User < Spinach::FeatureSteps
end
def contributed_project
@contributed_project ||= create(:empty_project, :public)
@contributed_project ||= create(:project, :public)
end
end
......@@ -4,7 +4,7 @@ describe Admin::ApplicationSettingsController do
include StubENV
let(:group) { create(:group) }
let(:project) { create(:empty_project, namespace: group) }
let(:project) { create(:project, namespace: group) }
let(:admin) { create(:admin) }
let(:user) { create(:user)}
......
......@@ -29,8 +29,8 @@ describe Admin::DashboardController do
it 'does not retrieve projects that are pending deletion' do
sign_in(create(:admin))
project = create(:empty_project)
pending_delete_project = create(:empty_project, pending_delete: true)
project = create(:project)
pending_delete_project = create(:project, pending_delete: true)
get :index
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Admin::GroupsController do
let(:group) { create(:group) }
let(:project) { create(:empty_project, namespace: group) }
let(:project) { create(:project, namespace: group) }
let(:admin) { create(:admin) }
before do
......
require 'spec_helper'
describe Admin::ProjectsController do
let!(:project) { create(:empty_project, :public) }
let!(:project) { create(:project, :public) }
before do
sign_in(create(:admin))
......
......@@ -8,7 +8,7 @@ describe Admin::ServicesController do
end
describe 'GET #edit' do
let!(:project) { create(:empty_project) }
let!(:project) { create(:project) }
Service.available_services_names.each do |service_name|
context "#{service_name}" do
......@@ -27,7 +27,7 @@ describe Admin::ServicesController do
end
describe "#update" do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let!(:service) do
RedmineService.create(
project: project,
......
......@@ -9,7 +9,7 @@ describe Admin::UsersController do
end
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) }
before do
......
require 'spec_helper'
describe AutocompleteController do
let!(:project) { create(:empty_project) }
let!(:project) { create(:project) }
let!(:user) { create(:user) }
context 'GET users' do
......@@ -105,7 +105,7 @@ describe AutocompleteController do
end
context 'non-member login for public project' do
let!(:project) { create(:empty_project, :public) }
let!(:project) { create(:project, :public) }
before do
sign_in(non_member)
......@@ -167,7 +167,7 @@ describe AutocompleteController do
end
context 'unauthenticated user' do
let(:public_project) { create(:empty_project, :public) }
let(:public_project) { create(:project, :public) }
let(:body) { JSON.parse(response.body) }
describe 'GET #users with public project' do
......@@ -271,8 +271,8 @@ describe AutocompleteController do
end
context 'GET projects' do
let(:authorized_project) { create(:empty_project) }
let(:authorized_search_project) { create(:empty_project, name: 'rugged') }
let(:authorized_project) { create(:project) }
let(:authorized_search_project) { create(:project, name: 'rugged') }
before do
sign_in(user)
......@@ -329,8 +329,8 @@ describe AutocompleteController do
context 'authorized projects apply limit' do
before do
authorized_project2 = create(:empty_project)
authorized_project3 = create(:empty_project)
authorized_project2 = create(:project)
authorized_project3 = create(:project)
authorized_project.add_master(user)
authorized_project2.add_master(user)
......@@ -355,8 +355,8 @@ describe AutocompleteController do
context 'authorized projects with offset' do
before do
authorized_project2 = create(:empty_project)
authorized_project3 = create(:empty_project)
authorized_project2 = create(:project)
authorized_project3 = create(:project)
authorized_project.add_master(user)
authorized_project2.add_master(user)
......
require 'spec_helper'
describe Dashboard::LabelsController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
let!(:label) { create(:label, project: project) }
......@@ -11,7 +11,7 @@ describe Dashboard::LabelsController do
end
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
get :index, format: :json
......
require 'spec_helper'
describe Dashboard::MilestonesController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:project_milestone) { create(:milestone, project: project) }
let(:milestone) do
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Dashboard::TodosController do
let(:user) { create(:user) }
let(:author) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:todo_service) { TodoService.new }
before do
......@@ -14,7 +14,7 @@ describe Dashboard::TodosController do
describe 'GET #index' do
context 'project authorization' 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
......@@ -34,7 +34,7 @@ describe Dashboard::TodosController do
end
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
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe DashboardController do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
before do
project.team << [user, :master]
......
require 'spec_helper'
describe Projects::BoardsController do # rubocop:disable RSpec/FilePath
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
......
require('spec_helper')
describe ProjectsController do # rubocop:disable RSpec/FilePath
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
......
......@@ -3,8 +3,8 @@ require 'spec_helper'
describe Explore::ProjectsController do
describe 'GET #trending' do
context 'sorting by update date' do
let(:project1) { create(:empty_project, :public, updated_at: 3.days.ago) }
let(:project2) { create(:empty_project, :public, updated_at: 1.day.ago) }
let(:project1) { create(:project, :public, updated_at: 3.days.ago) }
let(:project2) { create(:project, :public, updated_at: 1.day.ago) }
before do
create(:trending_project, project: project1)
......
......@@ -2,8 +2,8 @@ require 'spec_helper'
describe Groups::MilestonesController do
let(:group) { create(:group) }
let!(:project) { create(:empty_project, group: group) }
let!(:project2) { create(:empty_project, group: group) }
let!(:project) { create(:project, group: group) }
let!(:project2) { create(:project, group: group) }
let(:user) { create(:user) }
let(:title) { '肯定不是中文的问题' }
let(:milestone) do
......
......@@ -3,7 +3,7 @@ require 'rails_helper'
describe GroupsController do
let(:user) { create(:user) }
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) }
describe 'GET #index' do
......
......@@ -52,7 +52,7 @@ describe Import::BitbucketController do
end
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])
get :status
......@@ -63,7 +63,7 @@ describe Import::BitbucketController do
end
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])
get :status
......
......@@ -16,7 +16,7 @@ describe Import::FogbugzController do
end
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])
get :status
......@@ -26,7 +26,7 @@ describe Import::FogbugzController do
end
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])
get :status
......
......@@ -36,7 +36,7 @@ describe Import::GitlabController do
end
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])
get :status
......@@ -46,7 +46,7 @@ describe Import::GitlabController do
end
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])
get :status
......
......@@ -27,7 +27,7 @@ describe Import::GoogleCodeController do
end
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: [])
get :status
......@@ -38,7 +38,7 @@ describe Import::GoogleCodeController do
end
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: [])
get :status
......
require 'spec_helper'
describe NotificationSettingsController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:group) { create(:group, :internal) }
let(:user) { create(:user) }
......@@ -99,7 +99,7 @@ describe NotificationSettingsController do
end
context 'not authorized' do
let(:private_project) { create(:empty_project, :private) }
let(:private_project) { create(:project, :private) }
before do
sign_in(user)
......
......@@ -3,7 +3,7 @@ require 'rails_helper'
describe Projects::ApproverGroupsController do
describe '#destroy' do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:merge_request) { create(:merge_request, source_project: project) }
before do
......
......@@ -3,7 +3,7 @@ require 'rails_helper'
describe Projects::ApproversController do
describe '#destroy' do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:merge_request) { create(:merge_request, source_project: project) }
before do
......
require 'spec_helper'
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) }
before do
......
......@@ -193,7 +193,7 @@ describe Projects::BlobController do
context "when user doesn't have access" do
before do
other_project = create(:empty_project)
other_project = create(:project, :repository)
merge_request.update!(source_project: other_project, target_project: other_project)
end
......
require 'spec_helper'
describe Projects::Boards::IssuesController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:board) { create(:board, project: project) }
let(:user) { create(:user) }
let(:guest) { create(:user) }
......
require 'spec_helper'
describe Projects::Boards::ListsController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:board) { create(:board, project: project) }
let(:user) { create(:user) }
let(:guest) { create(:user) }
......
require 'spec_helper'
describe Projects::BoardsController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
......
......@@ -96,7 +96,7 @@ describe Projects::BranchesController do
end
context 'repository-less project' do
let(:project) { create :empty_project }
let(:project) { create :project }
it 'redirects to newly created branch' do
result = { status: :success, branch: double(name: branch) }
......
......@@ -24,8 +24,8 @@ describe Projects::DeployKeysController do
end
context 'when json requested' do
let(:project2) { create(:empty_project, :internal)}
let(:project_private) { create(:empty_project, :private)}
let(:project2) { create(:project, :internal)}
let(:project_private) { create(:project, :private)}
let(:deploy_key_internal) do
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
include ApiHelpers
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:environment) { create(:environment, name: 'production', project: project) }
before do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::EnvironmentsController do
set(:user) { create(:user) }
set(:project) { create(:empty_project) }
set(:project) { create(:project) }
set(:environment) do
create(:environment, name: 'production', project: project)
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::GroupLinksController do
let(:group) { 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) }
before do
......
require 'spec_helper'
describe Projects::HooksController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::ImportsController do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
before do
sign_in(user)
......
......@@ -78,7 +78,7 @@ describe Projects::IssuesController do
end
describe 'issue weights' do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:issue) { create(:issue, project: project, weight: 5) }
let(:issue2) { create(:issue, project: project, weight: 1) }
......
......@@ -234,7 +234,7 @@ describe Projects::IssuesController do
end
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
before do
......@@ -594,7 +594,7 @@ describe Projects::IssuesController do
describe 'POST #create' do
def post_new_issue(issue_attrs = {}, additional_params = {})
sign_in(user)
project = create(:empty_project, :public)
project = create(:project, :public)
project.team << [user, :developer]
post :create, {
......@@ -817,7 +817,7 @@ describe Projects::IssuesController do
context "when the user is owner" do
let(:owner) { create(:user) }
let(:namespace) { create(:namespace, owner: owner) }
let(:project) { create(:empty_project, namespace: namespace) }
let(:project) { create(:project, namespace: namespace) }
before do
sign_in(owner)
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::JobsController do
include ApiHelpers
let(:project) { create(:empty_project, :public) }
let(:project) { create(:project, :public) }
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:user) { create(:user) }
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::LabelsController do
let(:group) { create(:group) }
let(:project) { create(:empty_project, namespace: group) }
let(:project) { create(:project, namespace: group) }
let(:user) { create(:user) }
before do
......@@ -73,7 +73,7 @@ describe Projects::LabelsController do
describe 'POST #generate' 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
post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project
......
require 'spec_helper'
describe Projects::MattermostsController do
let!(:project) { create(:empty_project) }
let!(:project) { create(:project) }
let!(:user) { create(:user) }
before do
......
......@@ -80,7 +80,7 @@ describe Projects::MergeRequests::CreationsController do
context 'when the target project is a fork of a deleted project' do
before do
original_project = create(:empty_project)
original_project = create(:project)
project.update_attributes(forked_from_project: original_project, approvals_before_merge: 4)
original_project.update_attributes(pending_delete: true)
......
......@@ -145,7 +145,7 @@ describe Projects::MergeRequests::DiffsController do
end
context 'when the merge request belongs to a different project' do
let(:other_project) { create(:empty_project) }
let(:other_project) { create(:project) }
before do
other_project.team << [user, :master]
......
require 'spec_helper'
describe Projects::MilestonesController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:milestone) { create(:milestone, project: project) }
let(:issue) { create(:issue, project: project, milestone: milestone) }
......
......@@ -95,7 +95,7 @@ describe Projects::MirrorsController do
end
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
expect_any_instance_of(EE::Project).to receive(:force_import_job!)
......@@ -107,7 +107,7 @@ describe Projects::MirrorsController do
end
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
expect { do_put(project, mirror: false) }.to change { Project.mirror.count }.to(0)
......@@ -119,7 +119,7 @@ describe Projects::MirrorsController do
it 'forces update' do
expect_any_instance_of(EE::Project).to receive(:force_import_job!)
project = create(:empty_project, :mirror)
project = create(:project, :mirror)
sign_in(project.owner)
put :update_now, { namespace_id: project.namespace.to_param, project_id: project.to_param }
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::NotesController do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) }
let(:note) { create(:note, noteable: issue, project: project) }
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::PagesController do
let(:user) { create(:user) }
let(:project) { create(:empty_project, :public, :access_requestable) }
let(:project) { create(:project, :public, :access_requestable) }
let(:request_params) do
{
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::PagesDomainsController do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let!(:pages_domain) { create(:pages_domain, project: project) }
let(:request_params) do
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::PipelineSchedulesController do
include AccessMatchersForController
set(:project) { create(:empty_project, :public) }
set(:project) { create(:project, :public) }
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project) }
describe 'GET #index' do
......
......@@ -4,7 +4,7 @@ describe Projects::PipelinesController do
include ApiHelpers
let(:user) { create(:user) }
let(:project) { create(:empty_project, :public) }
let(:project) { create(:project, :public) }
let(:feature) { ProjectFeature::DISABLED }
before do
......
......@@ -2,7 +2,7 @@ require('spec_helper')
describe Projects::ProjectMembersController do
let(:user) { create(:user) }
let(:project) { create(:empty_project, :public, :access_requestable) }
let(:project) { create(:project, :public, :access_requestable) }
describe 'GET index' do
it 'should have the project_members address with a 200 status code' do
......@@ -158,7 +158,7 @@ describe Projects::ProjectMembersController do
end
context 'and is an owner' do
let(:project) { create(:empty_project, namespace: user.namespace) }
let(:project) { create(:project, namespace: user.namespace) }
before do
project.team << [user, :master]
......@@ -261,7 +261,7 @@ describe Projects::ProjectMembersController do
end
describe 'POST apply_import' do
let(:another_project) { create(:empty_project, :private) }
let(:another_project) { create(:project, :private) }
let(:member) { create(:user) }
before do
......
......@@ -2,7 +2,7 @@ require('spec_helper')
describe Projects::PrometheusController do
let(:user) { create(:user) }
let!(:project) { create(:empty_project) }
let!(:project) { create(:project) }
let(:prometheus_service) { double('prometheus_service') }
......
require 'spec_helper'
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) }
before do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::Registry::RepositoriesController do
let(:user) { create(:user) }
let(:project) { create(:empty_project, :private) }
let(:project) { create(:project, :private) }
before do
sign_in(user)
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::Registry::TagsController do
let(:user) { create(:user) }
let(:project) { create(:empty_project, :private) }
let(:project) { create(:project, :private) }
before do
sign_in(user)
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::RunnersController do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:runner) { create(:ci_runner) }
let(:params) do
......
......@@ -28,7 +28,7 @@ describe Projects::ServicesController do
context 'success' do
context 'with empty project' do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
context 'with chat notification service' do
let(:service) { project.create_microsoft_teams_service(webhook: 'http://webhook.com') }
......
require('spec_helper')
describe Projects::Settings::CiCdController do
let(:project) { create(:empty_project, :public, :access_requestable) }
let(:project) { create(:project, :public, :access_requestable) }
let(:user) { create(:user) }
before do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::Settings::IntegrationsController do
let(:namespace) { create(:group, :private) }
let(:project) { create(:empty_project, :private, namespace: namespace) }
let(:project) { create(:project, :private, namespace: namespace) }
let(:user) { create(:user) }
before do
......
require 'spec_helper'
describe Projects::Settings::SlacksController do
let(:project) { create(:empty_project, :public) }
let(:project) { create(:project, :public) }
let(:user) { create(:user) }
before do
......
......@@ -156,7 +156,7 @@ describe Projects::SnippetsController do
end
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 }
def update_snippet(snippet_params = {}, additional_params = {})
......
......@@ -2,7 +2,7 @@ require('spec_helper')
describe Projects::TodosController do
let(:user) { create(:user) }
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, source_project: project) }
......
require('spec_helper')
describe Projects::UploadsController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
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') }
......
require 'spec_helper'
describe Projects::VariablesController do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
......
require('spec_helper')
describe ProjectsController do
let(:project) { create(:empty_project) }
let(:public_project) { create(:empty_project, :public) }
let(:project) { create(:project) }
let(:public_project) { create(:project, :public) }
let(:user) { create(:user) }
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') }
......@@ -34,7 +34,7 @@ describe ProjectsController do
end
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
get :show, namespace_id: private_project.namespace, id: private_project
......@@ -199,7 +199,7 @@ describe ProjectsController do
end
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
expect(public_project_with_dot_atom).not_to be_valid
......@@ -208,7 +208,7 @@ describe ProjectsController do
context 'when the project is pending deletions' do
it 'renders a 404 error' do
project = create(:empty_project, pending_delete: true)
project = create(:project, pending_delete: true)
sign_in(user)
get :show, namespace_id: project.namespace, id: project
......@@ -219,7 +219,7 @@ describe ProjectsController do
context "redirection from http://someproject.git" 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
......@@ -431,7 +431,7 @@ describe ProjectsController do
end
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
delete(:remove_fork,
......
......@@ -8,7 +8,7 @@ describe SearchController do
end
it 'finds issue comments' do
project = create(:empty_project, :public)
project = create(:project, :public)
note = create(:note_on_issue, project: project)
get :show, project_id: project.id, scope: 'notes', search: note.note
......@@ -23,7 +23,7 @@ describe SearchController do
end
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)
get :show, project_id: project.id, scope: 'notes', search: note.note
......@@ -33,7 +33,7 @@ describe SearchController do
end
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)
get :show, project_id: project.id, scope: 'notes', search: note.note
......@@ -42,7 +42,7 @@ describe SearchController do
end
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)
get :show, project_id: project.id, scope: 'notes', search: note.note
......
......@@ -2,7 +2,7 @@ require 'rails_helper'
describe SentNotificationsController do
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(:issue) do
......
......@@ -273,7 +273,7 @@ describe SnippetsController do
end
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 }
def update_snippet(snippet_params = {}, additional_params = {})
......
......@@ -131,7 +131,7 @@ describe UploadsController do
describe "GET show" do
context 'Content-Disposition security measures' do
let(:project) { create(:empty_project, :public) }
let(:project) { create(:project, :public) }
context 'for PNG files' do
it 'returns Content-Disposition: inline' do
......@@ -203,7 +203,7 @@ describe UploadsController do
end
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
before do
......
......@@ -86,7 +86,7 @@ describe UsersController do
end
context 'forked project' do
let(:project) { create(:empty_project) }
let(:project) { create(:project) }
let(:forked_project) { Projects::ForkService.new(project, user).execute }
before do
......@@ -104,7 +104,7 @@ describe UsersController do
end
describe 'GET #calendar_activities' do
let!(:project) { create(:empty_project) }
let!(:project) { create(:project) }
let(:user) { create(:user) }
before do
......
......@@ -8,7 +8,7 @@ FactoryGirl.define do
trait :project_event do
entity_type 'Project'
entity_id { create(:empty_project).id }
entity_id { create(:project).id }
end
trait :group_event do
......
FactoryGirl.define do
factory :board do
sequence(:name) { |n| "board#{n}" }
project factory: :empty_project
project
after(:create) do |board|
board.lists.create(list_type: :closed)
......
......@@ -5,7 +5,7 @@ FactoryGirl.define do
ref 'master'
active true
description "pipeline schedule"
project factory: :empty_project
project
trait :nightly do
cron '0 1 * * *'
......
......@@ -5,7 +5,7 @@ FactoryGirl.define do
sha '97de212e80737a608d939f648d959671fb0a0142'
status 'pending'
project factory: :empty_project
project
factory :ci_pipeline_without_jobs do
after(:build) do |pipeline|
......
FactoryGirl.define do
factory :ci_runner_project, class: Ci::RunnerProject do
runner factory: :ci_runner
project factory: :empty_project
project
end
end
......@@ -7,6 +7,6 @@ FactoryGirl.define do
protected true
end
project factory: :empty_project
project
end
end
......@@ -3,7 +3,7 @@ require_relative '../support/repo_helpers'
FactoryGirl.define do
factory :commit do
git_commit RepoHelpers.sample_commit
project factory: :empty_project
project
initialize_with do
new(git_commit, project)
......
FactoryGirl.define do
factory :deploy_keys_project do
deploy_key
project factory: :empty_project
project
end
end
......@@ -2,12 +2,10 @@ FactoryGirl.define do
factory :environment, class: Environment do
sequence(:name) { |n| "environment#{n}" }
project factory: :empty_project
association :project, :repository
sequence(:external_url) { |n| "https://env#{n}.example.gitlab.com" }
trait :with_review_app do |environment|
project
transient do
ref 'master'
end
......
FactoryGirl.define do
factory :event do
project factory: :empty_project
project
author factory: :user
trait(:created) { action Event::CREATED }
......
......@@ -2,7 +2,7 @@ FactoryGirl.define do
factory :file_uploader do
skip_create
project factory: :empty_project
project
secret nil
transient do
......
FactoryGirl.define do
factory :forked_project_link do
association :forked_to_project, factory: :project
association :forked_from_project, factory: :project
association :forked_to_project, factory: [:project, :repository]
association :forked_from_project, factory: [:project, :repository]
after(:create) do |link|
link.forked_from_project.reload
......@@ -9,7 +9,7 @@ FactoryGirl.define do
end
trait :forked_to_empty_project do
association :forked_to_project, factory: :empty_project
association :forked_to_project, factory: :project
end
end
end
......@@ -7,6 +7,6 @@ FactoryGirl.define do
source 0
branches_affected 0
tags_affected 0
project factory: :empty_project
project
end
end
FactoryGirl.define do
factory :geo_project_registry, class: Geo::ProjectRegistry do
project factory: :empty_project
project
last_repository_synced_at nil
last_repository_successful_sync_at nil
last_wiki_synced_at nil
......
......@@ -2,7 +2,7 @@ FactoryGirl.define do
factory :issue do
title { generate(:title) }
author
project factory: :empty_project
project
trait :confidential do
confidential true
......
FactoryGirl.define do
factory :label_priority do
project factory: :empty_project
project
label
sequence(:priority)
end
......
......@@ -5,7 +5,7 @@ FactoryGirl.define do
end
factory :label, traits: [:base_label], class: ProjectLabel do
project factory: :empty_project
project
transient do
priority nil
......
......@@ -27,7 +27,7 @@ FactoryGirl.define do
elsif evaluator.project_id
milestone.project_id = evaluator.project_id
else
milestone.project = create(:empty_project)
milestone.project = create(:project)
end
end
......
......@@ -4,7 +4,7 @@ include ActionDispatch::TestProcess
FactoryGirl.define do
factory :note do
project factory: :empty_project
project
note { generate(:title) }
author
on_issue
......
FactoryGirl.define do
factory :notification_setting do
source factory: :empty_project
source factory: :project
user
level 3
events []
......
FactoryGirl.define do
factory :project_group_link do
project factory: :empty_project
project
group
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