diff options
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 3bc6fb09778..8f951605954 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -82,7 +82,7 @@ describe Project do end describe '#members & #requesters' do - let(:project) { create(:empty_project, :public, :access_requestable) } + let(:project) { create(:project, :public, :access_requestable) } let(:requester) { create(:user) } let(:developer) { create(:user) } before do @@ -131,7 +131,7 @@ describe Project do end describe 'validation' do - let!(:project) { create(:empty_project) } + let!(:project) { create(:project) } it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_uniqueness_of(:name).scoped_to(:namespace_id) } @@ -154,7 +154,7 @@ describe Project do it { is_expected.to validate_presence_of(:repository_storage) } it 'does not allow new projects beyond user limits' do - project2 = build(:empty_project) + project2 = build(:project) allow(project2).to receive(:creator).and_return(double(can_create_project?: false, projects_limit: 0).as_null_object) expect(project2).not_to be_valid expect(project2.errors[:limit_reached].first).to match(/Personal project creation is not allowed/) @@ -163,7 +163,7 @@ describe Project do describe 'wiki path conflict' do context "when the new path has been used by the wiki of other Project" do it 'has an error on the name attribute' do - new_project = build_stubbed(:empty_project, namespace_id: project.namespace_id, path: "#{project.path}.wiki") + new_project = build_stubbed(:project, namespace_id: project.namespace_id, path: "#{project.path}.wiki") expect(new_project).not_to be_valid expect(new_project.errors[:name].first).to eq('has already been taken') @@ -172,8 +172,8 @@ describe Project do context "when the new wiki path has been used by the path of other Project" do it 'has an error on the name attribute' do - project_with_wiki_suffix = create(:empty_project, path: 'foo.wiki') - new_project = build_stubbed(:empty_project, namespace_id: project_with_wiki_suffix.namespace_id, path: 'foo') + project_with_wiki_suffix = create(:project, path: 'foo.wiki') + new_project = build_stubbed(:project, namespace_id: project_with_wiki_suffix.namespace_id, path: 'foo') expect(new_project).not_to be_valid expect(new_project.errors[:name].first).to eq('has already been taken') @@ -182,7 +182,7 @@ describe Project do end context 'repository storages inclussion' do - let(:project2) { build(:empty_project, repository_storage: 'missing') } + let(:project2) { build(:project, repository_storage: 'missing') } before do storages = { 'custom' => { 'path' => 'tmp/tests/custom_repositories' } } @@ -196,44 +196,44 @@ describe Project do end it 'does not allow an invalid URI as import_url' do - project2 = build(:empty_project, import_url: 'invalid://') + project2 = build(:project, import_url: 'invalid://') expect(project2).not_to be_valid end it 'does allow a valid URI as import_url' do - project2 = build(:empty_project, import_url: 'ssh://test@gitlab.com/project.git') + project2 = build(:project, import_url: 'ssh://test@gitlab.com/project.git') expect(project2).to be_valid end it 'allows an empty URI' do - project2 = build(:empty_project, import_url: '') + project2 = build(:project, import_url: '') expect(project2).to be_valid end it 'does not produce import data on an empty URI' do - project2 = build(:empty_project, import_url: '') + project2 = build(:project, import_url: '') expect(project2.import_data).to be_nil end it 'does not produce import data on an invalid URI' do - project2 = build(:empty_project, import_url: 'test://') + project2 = build(:project, import_url: 'test://') expect(project2.import_data).to be_nil end it "does not allow blocked import_url localhost" do - project2 = build(:empty_project, import_url: 'http://localhost:9000/t.git') + project2 = build(:project, import_url: 'http://localhost:9000/t.git') expect(project2).to be_invalid expect(project2.errors[:import_url]).to include('imports are not allowed from that URL') end it "does not allow blocked import_url port" do - project2 = build(:empty_project, import_url: 'http://github.com:25/t.git') + project2 = build(:project, import_url: 'http://github.com:25/t.git') expect(project2).to be_invalid expect(project2.errors[:import_url]).to include('imports are not allowed from that URL') @@ -241,11 +241,11 @@ describe Project do describe 'project pending deletion' do let!(:project_pending_deletion) do - create(:empty_project, + create(:project, pending_delete: true) end let(:new_project) do - build(:empty_project, + build(:project, name: project_pending_deletion.name, namespace: project_pending_deletion.namespace) end @@ -261,27 +261,27 @@ describe Project do describe 'path validation' do it 'allows paths reserved on the root namespace' do - project = build(:empty_project, path: 'api') + project = build(:project, path: 'api') expect(project).to be_valid end it 'rejects paths reserved on another level' do - project = build(:empty_project, path: 'tree') + project = build(:project, path: 'tree') expect(project).not_to be_valid end it 'rejects nested paths' do parent = create(:group, :nested, path: 'environments') - project = build(:empty_project, path: 'folders', namespace: parent) + project = build(:project, path: 'folders', namespace: parent) expect(project).not_to be_valid end it 'allows a reserved group name' do parent = create(:group) - project = build(:empty_project, path: 'avatar', namespace: parent) + project = build(:project, path: 'avatar', namespace: parent) expect(project).to be_valid end @@ -290,12 +290,12 @@ describe Project do describe 'project token' do it 'sets an random token if none provided' do - project = FactoryGirl.create :empty_project, runners_token: '' + project = FactoryGirl.create :project, runners_token: '' expect(project.runners_token).not_to eq('') end it 'does not set an random token if one provided' do - project = FactoryGirl.create :empty_project, runners_token: 'my-token' + project = FactoryGirl.create :project, runners_token: 'my-token' expect(project.runners_token).to eq('my-token') end end @@ -323,7 +323,7 @@ describe Project do describe '#to_reference' do let(:owner) { create(:user, name: 'Gitlab') } let(:namespace) { create(:namespace, path: 'sample-namespace', owner: owner) } - let(:project) { create(:empty_project, path: 'sample-project', namespace: namespace) } + let(:project) { create(:project, path: 'sample-project', namespace: namespace) } let(:group) { create(:group, name: 'Group', path: 'sample-group', owner: owner) } context 'when nil argument' do @@ -347,7 +347,7 @@ describe Project do end context 'when cross namespace project argument' do - let(:another_namespace_project) { create(:empty_project, name: 'another-project') } + let(:another_namespace_project) { create(:project, name: 'another-project') } it 'returns complete path to the project' do expect(project.to_reference(another_namespace_project)).to eq 'sample-namespace/sample-project' @@ -355,7 +355,7 @@ describe Project do end context 'when same namespace / cross-project argument' do - let(:another_project) { create(:empty_project, namespace: namespace) } + let(:another_project) { create(:project, namespace: namespace) } it 'returns path to the project' do expect(project.to_reference(another_project)).to eq 'sample-project' @@ -364,7 +364,7 @@ describe Project do context 'when different namespace / cross-project argument' do let(:another_namespace) { create(:namespace, path: 'another-namespace', owner: owner) } - let(:another_project) { create(:empty_project, path: 'another-project', namespace: another_namespace) } + let(:another_project) { create(:project, path: 'another-project', namespace: another_namespace) } it 'returns full path to the project' do expect(project.to_reference(another_project)).to eq 'sample-namespace/sample-project' @@ -389,7 +389,7 @@ describe Project do describe '#to_human_reference' do let(:owner) { create(:user, name: 'Gitlab') } let(:namespace) { create(:namespace, name: 'Sample namespace', owner: owner) } - let(:project) { create(:empty_project, name: 'Sample project', namespace: namespace) } + let(:project) { create(:project, name: 'Sample project', namespace: namespace) } context 'when nil argument' do it 'returns nil' do @@ -404,7 +404,7 @@ describe Project do end context 'when cross namespace project argument' do - let(:another_namespace_project) { create(:empty_project, name: 'another-project') } + let(:another_namespace_project) { create(:project, name: 'another-project') } it 'returns complete name with namespace of the project' do expect(project.to_human_reference(another_namespace_project)).to eq 'Gitlab / Sample project' @@ -412,7 +412,7 @@ describe Project do end context 'when same namespace / cross-project argument' do - let(:another_project) { create(:empty_project, namespace: namespace) } + let(:another_project) { create(:project, namespace: namespace) } it 'returns name of the project' do expect(project.to_human_reference(another_project)).to eq 'Sample project' @@ -421,7 +421,7 @@ describe Project do end describe '#repository_storage_path' do - let(:project) { create(:empty_project, repository_storage: 'custom') } + let(:project) { create(:project, repository_storage: 'custom') } before do FileUtils.mkdir('tmp/tests/custom_repositories') @@ -444,7 +444,7 @@ describe Project do end describe "#web_url" do - let(:project) { create(:empty_project, path: "somewhere") } + let(:project) { create(:project, path: "somewhere") } it 'returns the full web URL for this repo' do expect(project.web_url).to eq("#{Gitlab.config.gitlab.url}/#{project.namespace.full_path}/somewhere") @@ -452,7 +452,7 @@ describe Project do end describe "#new_issue_address" do - let(:project) { create(:empty_project, path: "somewhere") } + let(:project) { create(:project, path: "somewhere") } let(:user) { create(:user) } context 'incoming email enabled' do @@ -481,7 +481,7 @@ describe Project do describe 'last_activity methods' do let(:timestamp) { 2.hours.ago } # last_activity_at gets set to created_at upon creation - let(:project) { create(:empty_project, created_at: timestamp, updated_at: timestamp) } + let(:project) { create(:project, created_at: timestamp, updated_at: timestamp) } describe 'last_activity' do it 'alias last_activity to last_event' do @@ -506,7 +506,7 @@ describe Project do end describe '#get_issue' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } let!(:issue) { create(:issue, project: project) } let(:user) { create(:user) } @@ -581,7 +581,7 @@ describe Project do end describe '#issue_exists?' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } it 'is truthy when issue exists' do expect(project).to receive(:get_issue).and_return(double) @@ -598,7 +598,7 @@ describe Project do context 'with namespace' do before do @group = create :group, name: 'gitlab' - @project = create(:empty_project, name: 'gitlabhq', namespace: @group) + @project = create(:project, name: 'gitlabhq', namespace: @group) end it { expect(@project.to_param).to eq('gitlabhq') } @@ -606,7 +606,7 @@ describe Project do context 'with invalid path' do it 'returns previous path to keep project suitable for use in URLs when persisted' do - project = create(:empty_project, path: 'gitlab') + project = create(:project, path: 'gitlab') project.path = 'foo&bar' expect(project).not_to be_valid @@ -614,7 +614,7 @@ describe Project do end it 'returns current path when new record' do - project = build(:empty_project, path: 'gitlab') + project = build(:project, path: 'gitlab') project.path = 'foo&bar' expect(project).not_to be_valid @@ -633,7 +633,7 @@ describe Project do describe '#default_issues_tracker?' do it "is true if used internal tracker" do - project = build(:empty_project) + project = build(:project) expect(project.default_issues_tracker?).to be_truthy end @@ -647,7 +647,7 @@ describe Project do end describe '#external_issue_tracker' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } let(:ext_project) { create(:redmine_project) } context 'on existing projects with no value for has_external_issue_tracker' do @@ -682,7 +682,7 @@ describe Project do end describe '#cache_has_external_issue_tracker' do - let(:project) { create(:empty_project, has_external_issue_tracker: nil) } + let(:project) { create(:project, has_external_issue_tracker: nil) } it 'stores true if there is any external_issue_tracker' do services = double(:service, external_issue_trackers: [RedmineService.new]) @@ -704,9 +704,9 @@ describe Project do end describe '#has_wiki?' do - let(:no_wiki_project) { create(:empty_project, :wiki_disabled, has_external_wiki: false) } - let(:wiki_enabled_project) { create(:empty_project) } - let(:external_wiki_project) { create(:empty_project, has_external_wiki: true) } + let(:no_wiki_project) { create(:project, :wiki_disabled, has_external_wiki: false) } + let(:wiki_enabled_project) { create(:project) } + let(:external_wiki_project) { create(:project, has_external_wiki: true) } it 'returns true if project is wiki enabled or has external wiki' do expect(wiki_enabled_project).to have_wiki @@ -716,7 +716,7 @@ describe Project do end describe '#external_wiki' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } context 'with an active external wiki' do before do @@ -770,7 +770,7 @@ describe Project do it 'counts stars from multiple users' do user1 = create :user user2 = create :user - project = create(:empty_project, :public) + project = create(:project, :public) expect(project.star_count).to eq(0) @@ -792,8 +792,8 @@ describe Project do it 'counts stars on the right project' do user = create :user - project1 = create(:empty_project, :public) - project2 = create(:empty_project, :public) + project1 = create(:project, :public) + project2 = create(:project, :public) expect(project1.star_count).to eq(0) expect(project2.star_count).to eq(0) @@ -825,7 +825,7 @@ describe Project do end describe '#avatar_type' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } it 'is true if avatar is image' do project.update_attribute(:avatar, 'uploads/avatar.png') @@ -841,10 +841,10 @@ describe Project do describe '#avatar_url' do subject { project.avatar_url } - let(:project) { create(:empty_project) } + let(:project) { create(:project) } context 'when avatar file is uploaded' do - let(:project) { create(:empty_project, :with_avatar) } + let(:project) { create(:project, :with_avatar) } let(:avatar_path) { "/uploads/-/system/project/avatar/#{project.id}/dk.png" } let(:gitlab_host) { "http://#{Gitlab.config.gitlab.host}" } @@ -869,7 +869,7 @@ describe Project do end context 'when git repo is empty' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } it { is_expected.to eq nil } end @@ -910,7 +910,7 @@ describe Project do end describe '#builds_enabled' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } subject { project.builds_enabled } @@ -921,7 +921,7 @@ describe Project do subject { described_class.with_shared_runners } context 'when shared runners are enabled for project' do - let!(:project) { create(:empty_project, shared_runners_enabled: true) } + let!(:project) { create(:project, shared_runners_enabled: true) } it "returns a project" do is_expected.to eq([project]) @@ -929,7 +929,7 @@ describe Project do end context 'when shared runners are disabled for project' do - let!(:project) { create(:empty_project, shared_runners_enabled: false) } + let!(:project) { create(:project, shared_runners_enabled: false) } it "returns an empty array" do is_expected.to be_empty @@ -939,8 +939,8 @@ describe Project do describe '.cached_count', :use_clean_rails_memory_store_caching do let(:group) { create(:group, :public) } - let!(:project1) { create(:empty_project, :public, group: group) } - let!(:project2) { create(:empty_project, :public, group: group) } + let!(:project1) { create(:project, :public, group: group) } + let!(:project2) { create(:project, :public, group: group) } it 'returns total project count' do expect(described_class).to receive(:count).once.and_call_original @@ -953,8 +953,8 @@ describe Project do describe '.trending' do let(:group) { create(:group, :public) } - let(:project1) { create(:empty_project, :public, group: group) } - let(:project2) { create(:empty_project, :public, group: group) } + let(:project1) { create(:project, :public, group: group) } + let(:project2) { create(:project, :public, group: group) } before do 2.times do @@ -985,9 +985,9 @@ describe Project do it 'returns only projects starred by the given user' do user1 = create(:user) user2 = create(:user) - project1 = create(:empty_project) - project2 = create(:empty_project) - create(:empty_project) + project1 = create(:project) + project2 = create(:project) + create(:project) user1.toggle_star(project1) user2.toggle_star(project2) @@ -996,7 +996,7 @@ describe Project do end describe '.visible_to_user' do - let!(:project) { create(:empty_project, :private) } + let!(:project) { create(:project, :private) } let!(:user) { create(:user) } subject { described_class.visible_to_user(user) } @@ -1015,7 +1015,7 @@ describe Project do end context 'repository storage by default' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } before do storages = { @@ -1033,7 +1033,7 @@ describe Project do end context 'shared runners by default' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } subject { project.shared_runners_enabled } @@ -1055,7 +1055,7 @@ describe Project do end describe '#any_runners' do - let(:project) { create(:empty_project, shared_runners_enabled: shared_runners_enabled) } + let(:project) { create(:project, shared_runners_enabled: shared_runners_enabled) } let(:specific_runner) { create(:ci_runner) } let(:shared_runner) { create(:ci_runner, :shared) } @@ -1103,7 +1103,7 @@ describe Project do subject { project.shared_runners } context 'when shared runners are enabled for project' do - let!(:project) { create(:empty_project, shared_runners_enabled: true) } + let!(:project) { create(:project, shared_runners_enabled: true) } it "returns a list of shared runners" do is_expected.to eq([runner]) @@ -1111,7 +1111,7 @@ describe Project do end context 'when shared runners are disabled for project' do - let!(:project) { create(:empty_project, shared_runners_enabled: false) } + let!(:project) { create(:project, shared_runners_enabled: false) } it "returns a empty list" do is_expected.to be_empty @@ -1120,7 +1120,7 @@ describe Project do end describe '#visibility_level_allowed?' do - let(:project) { create(:empty_project, :internal) } + let(:project) { create(:project, :internal) } context 'when checking on non-forked project' do it { expect(project.visibility_level_allowed?(Gitlab::VisibilityLevel::PRIVATE)).to be_truthy } @@ -1129,8 +1129,8 @@ describe Project do end context 'when checking on forked project' do - let(:project) { create(:empty_project, :internal) } - let(:forked_project) { create(:empty_project, forked_from_project: project) } + let(:project) { create(:project, :internal) } + let(:forked_project) { create(:project, forked_from_project: project) } it { expect(forked_project.visibility_level_allowed?(Gitlab::VisibilityLevel::PRIVATE)).to be_truthy } it { expect(forked_project.visibility_level_allowed?(Gitlab::VisibilityLevel::INTERNAL)).to be_truthy } @@ -1139,7 +1139,7 @@ describe Project do end describe '#pages_deployed?' do - let(:project) { create :empty_project } + let(:project) { create :project } subject { project.pages_deployed? } @@ -1158,7 +1158,7 @@ describe Project do describe '#pages_url' do let(:group) { create :group, name: group_name } - let(:project) { create :empty_project, namespace: group, name: project_name } + let(:project) { create :project, namespace: group, name: project_name } let(:domain) { 'Example.com' } subject { project.pages_url } @@ -1184,7 +1184,7 @@ describe Project do end describe '.search' do - let(:project) { create(:empty_project, description: 'kitten mittens') } + let(:project) { create(:project, description: 'kitten mittens') } it 'returns projects with a matching name' do expect(described_class.search(project.name)).to eq([project]) @@ -1241,7 +1241,7 @@ describe Project do end describe 'with pending_delete project' do - let(:pending_delete_project) { create(:empty_project, pending_delete: true) } + let(:pending_delete_project) { create(:project, pending_delete: true) } it 'shows pending deletion project' do search_result = described_class.search(pending_delete_project.name) @@ -1327,7 +1327,7 @@ describe Project do end describe '.search_by_title' do - let(:project) { create(:empty_project, name: 'kittens') } + let(:project) { create(:project, name: 'kittens') } it 'returns projects with a matching name' do expect(described_class.search_by_title(project.name)).to eq([project]) @@ -1346,8 +1346,8 @@ describe Project do let(:private_group) { create(:group, visibility_level: 0) } let(:internal_group) { create(:group, visibility_level: 10) } - let(:private_project) { create :empty_project, :private, group: private_group } - let(:internal_project) { create :empty_project, :internal, group: internal_group } + let(:private_project) { create :project, :private, group: private_group } + let(:internal_project) { create :project, :internal, group: internal_group } context 'when group is private project can not be internal' do it { expect(private_project.visibility_level_allowed?(Gitlab::VisibilityLevel::INTERNAL)).to be_falsey } @@ -1444,7 +1444,7 @@ describe Project do end describe '#user_can_push_to_empty_repo?' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } let(:user) { create(:user) } it 'returns false when default_branch_protection is in full protection and user is developer' do @@ -1483,7 +1483,7 @@ describe Project do end describe '#container_registry_url' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } subject { project.container_registry_url } @@ -1510,7 +1510,7 @@ describe Project do end describe '#has_container_registry_tags?' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } context 'when container registry is enabled' do before do @@ -1574,7 +1574,7 @@ describe Project do end describe '#ci_config_path=' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } it 'sets nil' do project.update!(ci_config_path: nil) @@ -1596,7 +1596,7 @@ describe Project do end describe 'Project import job' do - let(:project) { create(:empty_project, import_url: generate(:url)) } + let(:project) { create(:project, import_url: generate(:url)) } before do allow_any_instance_of(Gitlab::Shell).to receive(:import_repository) @@ -1633,7 +1633,7 @@ describe Project do end it 'does not perform housekeeping when project repository does not exist' do - project = create(:empty_project, :import_started, import_type: :github) + project = create(:project, :import_started, import_type: :github) project.import_finish @@ -1641,7 +1641,7 @@ describe Project do end it 'does not perform housekeeping when project does not have a valid import type' do - project = create(:empty_project, :import_started, import_type: nil) + project = create(:project, :import_started, import_type: nil) project.import_finish @@ -1746,7 +1746,7 @@ describe Project do context 'not forked' do it 'schedules a RepositoryImportWorker job' do - project = create(:empty_project, import_url: generate(:url)) + project = create(:project, import_url: generate(:url)) expect(RepositoryImportWorker).to receive(:perform_async).with(project.id) @@ -1756,19 +1756,19 @@ describe Project do end describe '#gitlab_project_import?' do - subject(:project) { build(:empty_project, import_type: 'gitlab_project') } + subject(:project) { build(:project, import_type: 'gitlab_project') } it { expect(project.gitlab_project_import?).to be true } end describe '#gitea_import?' do - subject(:project) { build(:empty_project, import_type: 'gitea') } + subject(:project) { build(:project, import_type: 'gitea') } it { expect(project.gitea_import?).to be true } end describe '#lfs_enabled?' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } shared_examples 'project overrides group' do it 'returns true when enabled in project' do @@ -1858,7 +1858,7 @@ describe Project do end describe '#pushes_since_gc' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } after do project.reset_pushes_since_gc @@ -1880,7 +1880,7 @@ describe Project do end describe '#increment_pushes_since_gc' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } after do project.reset_pushes_since_gc @@ -1894,7 +1894,7 @@ describe Project do end describe '#reset_pushes_since_gc' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } after do project.reset_pushes_since_gc @@ -1911,7 +1911,7 @@ describe Project do describe '#deployment_variables' do context 'when project has no deployment service' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } it 'returns an empty array' do expect(project.deployment_variables).to eq [] @@ -1930,7 +1930,7 @@ describe Project do end describe '#secret_variables_for' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } let!(:secret_variable) do create(:ci_variable, value: 'secret', project: project) @@ -1977,7 +1977,7 @@ describe Project do end describe '#protected_for?' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } subject { project.protected_for?('ref') } @@ -2014,7 +2014,7 @@ describe Project do end describe '#update_project_statistics' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } it "is called after creation" do expect(project.statistics).to be_a ProjectStatistics @@ -2034,9 +2034,9 @@ describe Project do end describe 'inside_path' do - let!(:project1) { create(:empty_project, namespace: create(:namespace, path: 'name_pace')) } - let!(:project2) { create(:empty_project) } - let!(:project3) { create(:empty_project, namespace: create(:namespace, path: 'namespace')) } + let!(:project1) { create(:project, namespace: create(:namespace, path: 'name_pace')) } + let!(:project2) { create(:project) } + let!(:project3) { create(:project, namespace: create(:namespace, path: 'namespace')) } let!(:path) { project1.namespace.full_path } it 'returns correct project' do @@ -2121,13 +2121,13 @@ describe Project do end describe '#parent' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } it { expect(project.parent).to eq(project.namespace) } end describe '#parent_changed?' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } before do project.namespace_id = 7 @@ -2153,7 +2153,7 @@ describe Project do end context 'top-level group' do - let(:project) { create :empty_project, namespace: group, name: project_name } + let(:project) { create :project, namespace: group, name: project_name } context 'group page' do let(:project_name) { 'group.example.com' } @@ -2169,7 +2169,7 @@ describe Project do end context 'nested group' do - let(:project) { create :empty_project, namespace: nested_group, name: project_name } + let(:project) { create :project, namespace: nested_group, name: project_name } let(:expected_url) { "http://group.example.com/#{nested_group.path}/#{project.path}" } context 'group page' do @@ -2187,7 +2187,7 @@ describe Project do end describe '#http_url_to_repo' do - let(:project) { create :empty_project } + let(:project) { create :project } it 'returns the url to the repo without a username' do expect(project.http_url_to_repo).to eq("#{project.web_url}.git") @@ -2207,7 +2207,7 @@ describe Project do end describe '#append_or_update_attribute' do - let(:project) { create(:empty_project) } + let(:project) { create(:project) } it 'shows full error updating an invalid MR' do error_message = 'Failed to replace merge_requests because one or more of the new records could not be saved.'\ @@ -2227,7 +2227,7 @@ describe Project do describe '#last_repository_updated_at' do it 'sets to created_at upon creation' do - project = create(:empty_project, created_at: 2.hours.ago) + project = create(:project, created_at: 2.hours.ago) expect(project.last_repository_updated_at.to_i).to eq(project.created_at.to_i) end @@ -2237,10 +2237,10 @@ describe Project do let!(:user) { create(:user) } let!(:private_project) do - create(:empty_project, :private, creator: user, namespace: user.namespace) + create(:project, :private, creator: user, namespace: user.namespace) end - let!(:public_project) { create(:empty_project, :public) } + let!(:public_project) { create(:project, :public) } context 'with a user' do let(:projects) do @@ -2266,7 +2266,7 @@ describe Project do end describe '#remove_private_deploy_keys' do - let!(:project) { create(:empty_project) } + let!(:project) { create(:project) } context 'for a private deploy key' do let!(:key) { create(:deploy_key, public: false) } @@ -2282,7 +2282,7 @@ describe Project do context 'when the key is linked to another project' do before do - another_project = create(:empty_project) + another_project = create(:project) create(:deploy_keys_project, deploy_key: key, project: another_project) end |