Commit 694f84e1 authored by Robert Speicher's avatar Robert Speicher

EE-specific changes for `:empty_project` and `:repository`

parent a15efe37
......@@ -5,7 +5,7 @@ describe Groups::AnalyticsController do
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, group: group) }
let(:project) { create(:project, :repository, group: group) }
let(:issue) { create(:issue, project: project) }
let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:push_data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
......
......@@ -78,7 +78,7 @@ describe Projects::IssuesController do
end
describe 'issue weights' do
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
let(:user) { create(:user) }
let(:issue) { create(:issue, project: project, weight: 5) }
let(:issue2) { create(:issue, project: project, weight: 1) }
......
require 'spec_helper'
describe Projects::MergeRequests::CreationsController do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:user) { project.owner }
let(:viewer) { user }
......
require 'spec_helper'
describe Projects::MergeRequestsController do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:user) { project.owner }
let(:viewer) { user }
......@@ -326,7 +326,7 @@ describe Projects::MergeRequestsController do
end
context 'approvals pending' do
let(:project) { create(:project, approvals_before_merge: 1) }
let(:project) { create(:project, :repository, approvals_before_merge: 1) }
it 'returns 200' do
expect_rebase_worker_for(viewer)
......@@ -338,7 +338,7 @@ describe Projects::MergeRequestsController do
end
context 'with a forked project' do
let(:fork_project) { create(:project, forked_from_project: project) }
let(:fork_project) { create(:project, :repository, forked_from_project: project) }
let(:fork_owner) { fork_project.owner }
before do
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::MirrorsController do
describe 'setting up a remote mirror' do
context 'when the current project is a mirror' do
let(:project) { create(:project, :mirror) }
let(:project) { create(:project, :repository, :mirror) }
before do
sign_in(project.owner)
......@@ -36,7 +36,7 @@ describe Projects::MirrorsController do
context 'when the current project is not a mirror' do
it 'allows to create a remote mirror' do
project = create(:project)
project = create(:project, :repository)
sign_in(project.owner)
expect do
......@@ -46,7 +46,7 @@ describe Projects::MirrorsController do
end
context 'when the current project has a remote mirror' do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:remote_mirror) { project.remote_mirrors.create!(enabled: 1, url: 'http://local.dev') }
before do
......@@ -95,7 +95,7 @@ describe Projects::MirrorsController do
end
context 'when project does not have a mirror' do
let(:project) { create(:project) }
let(:project) { create(:empty_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(:project, :mirror, :import_finished) }
let(:project) { create(:empty_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(:project, :mirror)
project = create(:empty_project, :mirror)
sign_in(project.owner)
put :update_now, { namespace_id: project.namespace.to_param, project_id: project.to_param }
......
......@@ -26,7 +26,7 @@ describe 'GlobalSearch' do
context "Respect feature visibility levels" do
context "Private projects" do
let(:project) { create(:project, :private) }
let(:project) { create(:project, :private, :repository) }
# The feature can be disabled but the data may actually exist
it "does not find items if features are disabled" do
......@@ -57,7 +57,7 @@ describe 'GlobalSearch' do
end
context "Internal projects" do
let(:project) { create(:project, :internal) }
let(:project) { create(:project, :internal, :repository) }
# The feature can be disabled but the data may actually exist
it "does not find items if features are disabled" do
......@@ -101,7 +101,7 @@ describe 'GlobalSearch' do
end
context "Public projects" do
let(:project) { create(:project, :public) }
let(:project) { create(:project, :public, :repository) }
# The feature can be disabled but the data may actually exist
it "does not find items if features are disabled" do
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe "Admin::Emails", :js do
let!(:current_user) { create(:admin) }
let!(:group) { create(:group) }
let!(:project) { create(:project, namespace: group) }
let!(:project) { create(:empty_project, namespace: group) }
describe "GET /admin/email" do
before do
......
......@@ -5,7 +5,7 @@ feature 'CI shared runner settings' do
let(:admin) { create(:admin) }
let(:group) { create(:group, :with_build_minutes) }
let!(:project) { create(:project, namespace: group, shared_runners_enabled: true) }
let!(:project) { create(:empty_project, namespace: group, shared_runners_enabled: true) }
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'CI shared runner limits' do
let(:user) { create(:user) }
let!(:project) { create(:project, namespace: group, shared_runners_enabled: true) }
let!(:project) { create(:project, :repository, namespace: group, shared_runners_enabled: true) }
let(:group) { create(:group) }
before do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Global elastic search' do
let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) }
let(:project) { create(:project, :repository, namespace: user.namespace) }
before do
stub_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
feature 'Group elastic search', :js do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
let(:project) { create(:project, :repository, namespace: group) }
def choose_group(group)
find('.js-search-group-dropdown').trigger('click')
......
......@@ -5,7 +5,7 @@ describe 'New/edit issue', :js do
include ActionView::Helpers::JavaScriptHelper
include FormHelper
let!(:project) { create(:project) }
let!(:project) { create(:empty_project) }
let!(:user) { create(:user)}
let!(:user2) { create(:user)}
let!(:milestone) { create(:milestone, project: project) }
......
......@@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Merge request approvals', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :public, approvals_before_merge: 1) }
let(:project) { create(:project, :public, :repository, approvals_before_merge: 1) }
context 'when editing an MR with a different author' do
let(:author) { create(:user) }
......@@ -30,7 +30,7 @@ feature 'Merge request approvals', :js do
context 'when creating an MR from a fork' do
let(:other_user) { create(:user) }
let(:non_member) { create(:user) }
let(:forked_project) { create(:project, :public, creator: user) }
let(:forked_project) { create(:project, :public, :repository, creator: user) }
before do
create(:forked_project_link, forked_to_project: forked_project, forked_from_project: project)
......@@ -269,7 +269,7 @@ feature 'Merge request approvals', :js do
context 'when merge when discussions resolved is active', :js do
let(:project) do
create(:project,
create(:project, :repository,
approvals_before_merge: 1,
only_allow_merge_if_all_discussions_are_resolved: true)
end
......
......@@ -87,7 +87,7 @@ feature 'Merge Request closing issues message', js: true do
project.team << [user, :developer]
end
let(:project) { create(:project, :public, approvals_before_merge: 1) }
let(:project) { create(:project, :public, :repository, approvals_before_merge: 1) }
let(:merge_request_description) { "Description\n\nclosing #{issue_1.to_reference}, #{issue_2.to_reference}" }
it 'displays closing issue message exactly one time' do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Merge With Push Rules Validation', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :public, push_rule: push_rule) }
let(:project) { create(:project, :public, :repository, push_rule: push_rule) }
let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: 'Bug NS-04') }
before do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Squashing merge requests', :js do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:source_branch) { 'csv' }
let!(:original_head) { project.repository.commit('master') }
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
feature 'Projects > Audit Events', :js do
let(:user) { create(:user) }
let(:pete) { create(:user, name: 'Pete') }
let(:project) { create(:project, namespace: user.namespace) }
let(:project) { create(:project, :repository, namespace: user.namespace) }
before do
project.team << [user, :master]
......
......@@ -354,7 +354,7 @@ feature 'Jobs' do
context 'job project is over shared runners limit' do
let(:group) { create(:group, :with_used_build_minutes_limit) }
let(:project) { create(:project, namespace: group, shared_runners_enabled: true) }
let(:project) { create(:project, :repository, namespace: group, shared_runners_enabled: true) }
it 'displays a warning message' do
visit project_job_path(project, job)
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Projects > Members > Member is removed from project' do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
background do
project.team << [user, :master]
......
require 'spec_helper'
feature 'Project mirror' do
let(:project) { create(:project, :mirror, :import_finished, creator: user, name: 'Victorialand') }
let(:project) { create(:project, :mirror, :import_finished, :repository, creator: user, name: 'Victorialand') }
let(:user) { create(:user) }
describe 'On a project', js: true do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
feature 'Path Locks', :js do
let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) }
let(:project) { create(:project, :repository, namespace: user.namespace) }
let(:tree_path) { project_tree_path(project, project.repository.root_ref) }
before do
......
require 'spec_helper'
feature 'Project remote mirror', feature: true do
let(:project) { create(:project, :remote_mirror) }
let(:project) { create(:project, :repository, :remote_mirror) }
let(:remote_mirror) { project.remote_mirrors.first }
let(:user) { create(:user) }
......
......@@ -18,7 +18,7 @@ describe SearchHelper do
end
it "returns parsed result" do
project = create :project
project = create :project, :repository
project.repository.index_blobs
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::AuthorityAnalyzer do
describe '#calculate' do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:author) { create(:user) }
let(:user_a) { create(:user) }
let(:user_b) { create(:user) }
......
......@@ -173,7 +173,7 @@ describe Gitlab::Checks::ChangeAccess do
it { is_expected.to be_truthy }
end
let(:project) { create(:project, :public, push_rule: push_rule) }
let(:project) { create(:project, :public, :repository, push_rule: push_rule) }
before do
allow(project.repository).to receive(:new_commits).and_return(
......
......@@ -8,7 +8,7 @@ describe Gitlab::Elastic::Indexer do
stub_application_setting(elasticsearch_url: ['http://localhost:9200'])
end
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:from_sha) { Gitlab::Git::BLANK_SHA }
let(:to_sha) { project.commit.try(:sha) }
let(:indexer) { described_class.new(project) }
......@@ -40,7 +40,7 @@ describe Gitlab::Elastic::Indexer do
end
context 'test project' do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
it 'runs the indexing command' do
expect_popen.with(
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Gitlab::Elastic::ProjectSearchResults do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:query) { 'hello world' }
before do
......@@ -34,8 +34,8 @@ describe Gitlab::Elastic::ProjectSearchResults do
describe "search" do
it "returns correct amounts" do
project = create :project, :public
project1 = create :project, :public
project = create :project, :public, :repository
project1 = create :project, :public, :repository
project.repository.index_blobs
project.repository.index_commits
......@@ -81,7 +81,7 @@ describe Gitlab::Elastic::ProjectSearchResults do
end
describe "search for commits in non-default branch" do
let(:project) { create(:project, :public, visibility) }
let(:project) { create(:project, :public, :repository, visibility) }
let(:visibility) { :repository_enabled }
let(:result) { described_class.new(user, 'initial', project.id, 'test') }
......
......@@ -12,8 +12,8 @@ describe Gitlab::Elastic::SearchResults do
end
let(:user) { create(:user) }
let(:project_1) { create(:project) }
let(:project_2) { create(:project) }
let(:project_1) { create(:project, :repository) }
let(:project_2) { create(:project, :repository) }
let(:limit_project_ids) { [project_1.id] }
describe 'issues' do
......@@ -334,7 +334,7 @@ describe Gitlab::Elastic::SearchResults do
describe 'project scoping' do
it "returns items for project" do
project = create :project, name: "term"
project = create :project, :repository, name: "term"
# Create issue
create :issue, title: 'bla-bla term', project: project
......@@ -383,7 +383,7 @@ describe Gitlab::Elastic::SearchResults do
end
it 'finds blobs from public projects only' do
project_2 = create :project, :private
project_2 = create :project, :repository, :private
project_2.repository.index_blobs
Gitlab::Elastic::Helper.refresh_index
......@@ -468,7 +468,7 @@ describe Gitlab::Elastic::SearchResults do
end
it 'finds wiki blobs from public projects only' do
project_2 = create :project, :private
project_2 = create :project, :repository, :private
project_2.wiki.create_page('index_page', 'term')
project_2.wiki.index_blobs
Gitlab::Elastic::Helper.refresh_index
......@@ -486,7 +486,7 @@ describe Gitlab::Elastic::SearchResults do
end
context 'when wiki is disabled' do
let(:project_1) { create(:project, :public, :wiki_disabled) }
let(:project_1) { create(:project, :public, :repository, :wiki_disabled) }
context 'search by member' do
let(:limit_project_ids) { [project_1.id] }
......@@ -502,7 +502,7 @@ describe Gitlab::Elastic::SearchResults do
end
context 'when wiki is internal' do
let(:project_1) { create(:project, :public, :wiki_private) }
let(:project_1) { create(:project, :public, :repository, :wiki_private) }
context 'search by member' do
let(:limit_project_ids) { [project_1.id] }
......@@ -534,7 +534,7 @@ describe Gitlab::Elastic::SearchResults do
end
it 'finds commits from public projects only' do
project_2 = create :project, :private
project_2 = create :project, :private, :repository
project_2.repository.index_commits
Gitlab::Elastic::Helper.refresh_index
......@@ -553,10 +553,10 @@ describe Gitlab::Elastic::SearchResults do
end
describe 'Visibility levels' do
let(:internal_project) { create(:project, :internal, description: "Internal project") }
let(:private_project1) { create(:project, :private, description: "Private project") }
let(:private_project2) { create(:project, :private, description: "Private project where I'm a member") }
let(:public_project) { create(:project, :public, description: "Public project") }
let(:internal_project) { create(:project, :internal, :repository, description: "Internal project") }
let(:private_project1) { create(:project, :private, :repository, description: "Private project") }
let(:private_project2) { create(:project, :private, :repository, description: "Private project where I'm a member") }
let(:public_project) { create(:project, :public, :repository, description: "Public project") }
let(:limit_project_ids) { [private_project2.id] }
before do
......
......@@ -928,7 +928,7 @@ describe Gitlab::GitAccess do
end
context 'when the repository is read only' do
let(:project) { create(:project, :read_only_repository) }
let(:project) { create(:project, :repository, :read_only_repository) }
it 'denies push access' do
project.team << [user, :master]
......
......@@ -12,7 +12,7 @@ describe MergeRequest, elastic: true do
end
it "searches merge requests" do
project = create :project
project = create :project, :repository
Sidekiq::Testing.inline! do
create :merge_request, title: 'bla-bla term1', source_project: project
......
......@@ -65,7 +65,7 @@ describe Note, elastic: true do
end
it "does not create ElasticIndexerWorker job for system messages" do
project = create :project
project = create :project, :repository
issue = create :issue, project: project
# Only issue should be updated
......
......@@ -12,7 +12,7 @@ describe Repository, elastic: true do
end
it "searches blobs and commits" do
project = create :project
project = create :project, :repository
Sidekiq::Testing.inline! do
project.repository.index_blobs
......@@ -28,8 +28,8 @@ describe Repository, elastic: true do
describe "class method find_commits_by_message_with_elastic" do
it "returns commits" do
project = create :project
project1 = create :project
project = create :project, :repository
project1 = create :project, :repository
project.repository.index_commits
project1.repository.index_commits
......@@ -44,7 +44,7 @@ describe Repository, elastic: true do
describe "find_commits_by_message_with_elastic" do
it "returns commits" do
project = create :project
project = create :project, :repository
project.repository.index_commits
......
......@@ -13,7 +13,7 @@ describe Snippet, elastic: true do
context 'searching snippets by code' do
let!(:author) { create(:user) }
let!(:project) { create(:project) }
let!(:project) { create(:empty_project) }
let!(:public_snippet) { create(:snippet, :public, content: 'password: XXX') }
let!(:internal_snippet) { create(:snippet, :internal, content: 'password: XXX') }
......
require 'spec_helper'
describe Ci::Build do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:pipeline) do
create(:ci_pipeline, project: project,
......
require 'spec_helper'
describe MergeRequest do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
subject(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
......@@ -19,7 +19,7 @@ describe MergeRequest do
end
context 'project allows rebase' do
let(:project) { create(:project, merge_requests_rebase_enabled: true) }
let(:project) { create(:project, :repository, merge_requests_rebase_enabled: true) }
it 'returns false when the project feature is unavailable' do
expect(merge_request.target_project).to receive(:feature_available?).with(:merge_request_rebase).at_least(:once).and_return(false)
......
......@@ -17,7 +17,7 @@ describe Project do
end
describe '#push_rule' do
let(:project) { create(:project, push_rule: create(:push_rule)) }
let(:project) { create(:empty_project, push_rule: create(:push_rule)) }
subject(:push_rule) { project.push_rule(true) }
......@@ -63,7 +63,7 @@ describe Project do
describe '#execute_hooks' do
it "triggers project and group hooks" do
group = create :group, name: 'gitlab'
project = create(:project, name: 'gitlabhq', namespace: group)
project = create(:empty_project, name: 'gitlabhq', namespace: group)
project_hook = create(:project_hook, push_events: true, project: project)
group_hook = create(:group_hook, push_events: true, group: group)
......@@ -78,7 +78,7 @@ describe Project do
end
describe '#allowed_to_share_with_group?' do
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
it "returns true" do
expect(project.allowed_to_share_with_group?).to be_truthy
......@@ -92,7 +92,7 @@ describe Project do
describe '#feature_available?' do
let(:namespace) { build_stubbed(:namespace) }
let(:project) { build_stubbed(:project, namespace: namespace) }
let(:project) { build_stubbed(:empty_project, namespace: namespace) }
let(:user) { build_stubbed(:user) }
subject { project.feature_available?(feature, user) }
......@@ -647,7 +647,7 @@ describe Project do
].each do |spec|
context spec.inspect do
let(:spec) { spec }
let(:project) { build(:project, approvals_before_merge: spec[:database]) }
let(:project) { build(:empty_project, approvals_before_merge: spec[:database]) }
subject { project.approvals_before_merge }
......@@ -669,7 +669,7 @@ describe Project do
].each do |spec|
context spec.inspect do
let(:spec) { spec }
let(:project) { build(:project, reset_approvals_on_push: spec[:database]) }
let(:project) { build(:empty_project, reset_approvals_on_push: spec[:database]) }
subject { project.reset_approvals_on_push? }
......@@ -691,7 +691,7 @@ describe Project do
].each do |spec|
context spec.inspect do
let(:spec) { spec }
let(:project) { build(:project, approvals_before_merge: spec[:database]) }
let(:project) { build(:empty_project, approvals_before_merge: spec[:database]) }
subject { project.approvals_before_merge }
......@@ -785,7 +785,7 @@ describe Project do
describe '#disabled_services' do
let(:namespace) { create(:group, :private) }
let(:project) { create(:project, :private, namespace: namespace) }
let(:project) { create(:empty_project, :private, namespace: namespace) }
let(:disabled_services) { %w(jenkins jenkins_deprecated) }
context 'without a license key' do
......
......@@ -28,7 +28,7 @@ describe ProjectMirrorData, type: :model do
end
describe '#reset_retry_count!' do
let(:mirror_data) { create(:project, :mirror, :import_finished).mirror_data }
let(:mirror_data) { create(:empty_project, :mirror, :import_finished).mirror_data }
it 'resets retry_count to 0' do
mirror_data.retry_count = 3
......@@ -38,7 +38,7 @@ describe ProjectMirrorData, type: :model do
end
describe '#increment_retry_count!' do
let(:mirror_data) { create(:project, :mirror, :import_finished).mirror_data }
let(:mirror_data) { create(:empty_project, :mirror, :import_finished).mirror_data }
it 'increments retry_count' do
expect { mirror_data.increment_retry_count! }.to change { mirror_data.retry_count }.from(0).to(1)
......@@ -46,7 +46,7 @@ describe ProjectMirrorData, type: :model do
end
describe '#set_next_execution_timestamp!' do
let(:mirror_data) { create(:project, :mirror, :import_finished).mirror_data }
let(:mirror_data) { create(:empty_project, :mirror, :import_finished).mirror_data }
let!(:timestamp) { Time.now }
let!(:jitter) { 2.seconds }
let(:interval) { 2.minutes }
......
......@@ -62,7 +62,7 @@ eos
end
describe 'multiproject enabled' do
let!(:project) { create(:project) }
let!(:project) { create(:empty_project) }
before do
@service = JenkinsDeprecatedService.new
allow(@service).to receive_messages(
......@@ -123,7 +123,7 @@ eos
describe '#execute' do
let(:user) { create(:user, username: 'username') }
let(:namespace) { create(:group, :private) }
let(:project) { create(:project, :private, name: 'project', namespace: namespace) }
let(:project) { create(:empty_project, :private, name: 'project', namespace: namespace) }
let(:push_sample_data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
let(:jenkins_service) { described_class.create(active: true, project: project) }
let!(:service_hook) { create(:service_hook, service: jenkins_service) }
......
......@@ -6,7 +6,7 @@ describe JenkinsService do
it { is_expected.to have_one :service_hook }
end
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
let(:jenkins_url) { 'http://jenkins.example.com/' }
let(:jenkins_hook_url) { jenkins_url + 'project/my_project' }
......@@ -125,7 +125,7 @@ describe JenkinsService do
describe '#test' do
it 'returns the right status' do
user = create(:user, username: 'username')
project = create(:project, name: 'project')
project = create(:empty_project, name: 'project')
push_sample_data = Gitlab::DataBuilder::Push.build_sample(project, user)
jenkins_service = described_class.create(jenkins_params)
stub_request(:post, jenkins_hook_url).with(headers: { 'Authorization' => jenkins_authorization })
......@@ -155,7 +155,7 @@ describe JenkinsService do
describe '#execute' do
let(:user) { create(:user, username: 'username') }
let(:namespace) { create(:group, :private) }
let(:project) { create(:project, :private, name: 'project', namespace: namespace) }
let(:project) { create(:empty_project, :private, name: 'project', namespace: namespace) }
let(:push_sample_data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
let(:jenkins_service) { described_class.create(jenkins_params) }
......@@ -217,7 +217,7 @@ describe JenkinsService do
end
describe 'Stored password invalidation' do
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
context 'when a password was previously set' do
before do
......@@ -268,7 +268,7 @@ describe JenkinsService do
context 'when no password was previously set' do
before do
@jenkins_service = described_class.create(
project: create(:project),
project: create(:empty_project),
properties: {
jenkins_url: 'http://jenkins.example.com/',
username: 'jenkins'
......
......@@ -126,7 +126,7 @@ describe Project do
context '#with_wiki_enabled' do
it 'returns a project' do
project = create(:project_empty_repo, wiki_access_level: ProjectFeature::ENABLED)
project1 = create(:project, wiki_access_level: ProjectFeature::DISABLED)
project1 = create(:empty_project, wiki_access_level: ProjectFeature::DISABLED)
expect(described_class.with_wiki_enabled).to include(project)
expect(described_class.with_wiki_enabled).not_to include(project1)
......@@ -201,7 +201,7 @@ describe Project do
context '#mark_stuck_remote_mirrors_as_failed!' do
it 'fails stuck remote mirrors' do
project = create(:project, :remote_mirror)
project = create(:project, :remote_mirror, :repository)
project.remote_mirrors.first.update_attributes(
update_status: :started,
......@@ -215,7 +215,7 @@ describe Project do
end
context 'mirror' do
subject { build(:project, mirror: true) }
subject { build(:empty_project, mirror: true) }
it { is_expected.to validate_presence_of(:import_url) }
it { is_expected.to validate_presence_of(:mirror_user) }
......@@ -1627,7 +1627,7 @@ describe Project do
describe 'handling import URL' do
context 'when project is a mirror' do
it 'returns the full URL' do
project = create(:project, :mirror, import_url: 'http://user:pass@test.com')
project = create(:empty_project, :mirror, import_url: 'http://user:pass@test.com')
project.import_finish
......@@ -1637,7 +1637,7 @@ describe Project do
context 'when project is not a mirror' do
it 'returns the sanitized URL' do
project = create(:project, import_status: 'started', import_url: 'http://user:pass@test.com')
project = create(:empty_project, import_status: 'started', import_url: 'http://user:pass@test.com')
project.import_finish
......@@ -1878,7 +1878,7 @@ describe Project do
end
context 'elasticsearch indexing enabled' do
let(:project) { create(:project, :import_started, import_type: :github) }
let(:project) { create(:empty_project, :import_started, import_type: :github) }
before do
stub_application_setting(elasticsearch_indexing: true)
......@@ -1988,7 +1988,7 @@ describe Project do
context 'when mirror is expected to run soon' do
it 'returns true' do
timestamp = Time.now
project = create(:project, :mirror, :import_finished)
project = create(:project, :mirror, :import_finished, :repository)
project.mirror_last_update_at = timestamp - 3.minutes
project.mirror_data.next_execution_timestamp = timestamp - 2.minutes
......@@ -1999,7 +1999,7 @@ describe Project do
context 'when mirror was scheduled' do
it 'returns true' do
project = create(:project, :mirror, :import_scheduled)
project = create(:project, :mirror, :import_scheduled, :repository)
expect(project.scheduled_mirror?).to be true
end
......@@ -2017,7 +2017,7 @@ describe Project do
context 'when project is not a mirror' do
it 'returns false' do
project = create(:project, :import_started)
project = create(:empty_project, :import_started)
expect(project.updating_mirror?).to be false
end
......@@ -2025,7 +2025,7 @@ describe Project do
context 'when mirror is in progress' do
it 'returns true' do
project = create(:project, :mirror, :import_started)
project = create(:project, :mirror, :import_started, :repository)
expect(project.updating_mirror?).to be true
end
......@@ -2035,7 +2035,7 @@ describe Project do
describe '#force_import_job!' do
it 'sets next execution timestamp to now and schedules UpdateAllMirrorsWorker' do
timestamp = Time.now
project = create(:project, :mirror)
project = create(:empty_project, :mirror)
project.mirror_data.update_attributes(next_execution_timestamp: timestamp - 3.minutes)
......@@ -2062,7 +2062,7 @@ describe Project do
context 'without mirror' do
it 'returns nil' do
project = create(:project)
project = create(:empty_project)
expect(project.add_import_job).to be_nil
end
......@@ -2080,7 +2080,7 @@ describe Project do
context 'with mirror' do
it 'schedules RepositoryUpdateMirrorWorker' do
project = create(:project, :mirror)
project = create(:project, :mirror, :repository)
expect(RepositoryUpdateMirrorWorker).to receive(:perform_async).with(project.id)
......@@ -2188,8 +2188,8 @@ describe Project do
end
context 'with valid paths' do
let!(:project1) { create(:project) }
let!(:project2) { create(:project) }
let!(:project1) { create(:empty_project) }
let!(:project2) { create(:empty_project) }
it 'returns the projects matching the paths' do
projects = described_class.where_full_path_in([project1.full_path,
......@@ -2222,8 +2222,8 @@ describe Project do
end
describe '#change_repository_storage' do
let(:project) { create(:project, repository_storage: 'a') }
let(:read_only_project) { create(:project, repository_storage: 'a', repository_read_only: true) }
let(:project) { create(:project, :repository, repository_storage: 'a') }
let(:read_only_project) { create(:project, :repository, repository_storage: 'a', repository_read_only: true) }
before do
FileUtils.mkdir('tmp/tests/storage_a')
......@@ -2336,7 +2336,7 @@ describe Project do
end
describe '#repository_and_lfs_size' do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:size) { 50 }
before do
......@@ -2355,7 +2355,7 @@ describe Project do
group = create :group
group1 = create :group
project = create :project
project = create :empty_project
project.approver_group_ids = "#{group.id}, #{group1.id}"
project.save!
......@@ -2506,7 +2506,7 @@ describe Project do
describe '#create_mirror_data' do
it 'it is called after save' do
project = create(:project)
project = create(:empty_project)
expect(project).to receive(:create_mirror_data)
......
......@@ -86,7 +86,7 @@ describe RemoteMirror do
end
context '#sync' do
let(:remote_mirror) { create(:project, :remote_mirror).remote_mirrors.first }
let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first }
before do
Timecop.freeze(Time.now)
......@@ -142,7 +142,7 @@ describe RemoteMirror do
end
context '#updated_since?' do
let(:remote_mirror) { create(:project, :remote_mirror).remote_mirrors.first }
let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first }
let(:timestamp) { Time.now - 5.minutes }
before do
......@@ -192,7 +192,7 @@ describe RemoteMirror do
end
def create_mirror(params)
project = FactoryGirl.create(:project)
project = FactoryGirl.create(:project, :repository)
project.remote_mirrors.create!(params)
end
end
......@@ -1422,8 +1422,8 @@ describe Repository do
describe "class method find_commits_by_message_with_elastic" do
it "returns commits" do
project = create :project
project1 = create :project
project = create :project, :repository
project1 = create :project, :repository
project.repository.index_commits
project1.repository.index_commits
......@@ -1438,7 +1438,7 @@ describe Repository do
describe "find_commits_by_message_with_elastic" do
it "returns commits" do
project = create :project
project = create :project, :repository
project.repository.index_commits
......
......@@ -185,7 +185,7 @@ describe API::Members do
context 'project in a group' do
it 'returns a 405 method not allowed error when group membership lock is enabled' do
group_with_membership_locked = create(:group, membership_lock: true)
project = create(:project, group: group_with_membership_locked)
project = create(:empty_project, group: group_with_membership_locked)
project.group.add_owner(master)
post api("/projects/#{project.id}/members", master),
......
......@@ -4,7 +4,7 @@ describe API::ProjectPushRule, 'ProjectPushRule', api: true do
include ApiHelpers
let(:user) { create(:user) }
let(:user3) { create(:user) }
let!(:project) { create(:project, creator_id: user.id, namespace: user.namespace) }
let!(:project) { create(:project, :repository, creator_id: user.id, namespace: user.namespace) }
before do
project.team << [user, :master]
......
......@@ -4,7 +4,7 @@ describe API::V3::ProjectPushRule, 'ProjectPushRule', api: true do
include ApiHelpers
let(:user) { create(:user) }
let(:user3) { create(:user) }
let!(:project) { create(:project, creator_id: user.id, namespace: user.namespace) }
let!(:project) { create(:project, :repository, creator_id: user.id, namespace: user.namespace) }
before do
project.team << [user, :master]
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::MirrorsController do
let(:project) do
create(:project,
create(:project, :repository,
mirror: true,
mirror_user: user,
import_url: 'http://user:pass@test.url')
......
......@@ -2,7 +2,7 @@ require "spec_helper"
describe "routes to the proper webhooks controller", type: :routing do
context 'with a project context' do
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
let(:project_hook) { create(:project_hook) }
it "routes the test action" do
......
......@@ -11,7 +11,7 @@ describe Issues::BuildService do # rubocop:disable RSpec/FilePath
context 'with an issue template' do
describe '#execute' do
it 'fills in the template in the description' do
project = build(:project, issues_template: 'Work hard, play hard!')
project = build(:empty_project, issues_template: 'Work hard, play hard!')
service = described_class.new(project, user)
issue = service.execute
......
require 'spec_helper'
describe Geo::MoveRepositoryService do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:new_path) { project.full_path + '+renamed' }
let(:full_new_path) { File.join(project.repository_storage_path, new_path) }
subject { described_class.new(project.id, project.name, project.full_path, new_path) }
......
require 'spec_helper'
describe Geo::RepositoryUpdatedEventStore do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:blankrev) { Gitlab::Git::BLANK_SHA }
let(:refs) { ['refs/heads/tést', 'refs/tags/tag'] }
......
require 'spec_helper'
describe Geo::ScheduleRepoCreateService do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
subject { described_class.new(project_id: project.id) }
describe '#execute' do
......
......@@ -4,7 +4,7 @@ describe Geo::ScheduleRepoUpdateService do
include RepoHelpers
let(:user) { create :user }
let(:project) { create :project }
let(:project) { create :project, :repository }
let(:blankrev) { Gitlab::Git::BLANK_SHA }
let(:oldrev) { sample_commit.parent_id }
......
......@@ -15,7 +15,7 @@ describe GitPushService do
end
describe 'with remote mirrors' do
let(:project) { create(:project, :remote_mirror) }
let(:project) { create(:project, :repository, :remote_mirror) }
subject do
described_class.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref)
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe MergeRequests::SquashService do
let(:service) { described_class.new(project, user, {}) }
let(:user) { project.owner }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:merge_request_with_one_commit) do
create(:merge_request,
......
......@@ -65,7 +65,7 @@ describe Projects::DestroyService do
context 'when has remote mirrors' do
let!(:project) do
create(:project, namespace: user.namespace).tap do |project|
create(:project, :repository, namespace: user.namespace).tap do |project|
project.remote_mirrors.create(url: 'http://test.com')
end
end
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::SlackApplicationInstallService do
let!(:user) { create(:user) }
let!(:project) { create(:project) }
let!(:project) { create(:empty_project) }
def service(params = {})
Projects::SlackApplicationInstallService.new(project, user, params)
......
require 'spec_helper'
describe Projects::UpdateMirrorService do
let(:project) { create(:project, :mirror, import_url: Project::UNKNOWN_IMPORT_URL) }
let(:project) { create(:project, :repository, :mirror, import_url: Project::UNKNOWN_IMPORT_URL) }
describe "#execute" do
context 'unlicensed' do
......@@ -124,7 +124,7 @@ describe Projects::UpdateMirrorService do
end
describe "when is no mirror" do
let(:project) { build_stubbed(:project) }
let(:project) { build_stubbed(:empty_project) }
it "success" do
expect(project.mirror?).to eq(false)
......
require 'spec_helper'
describe Projects::UpdateRemoteMirrorService do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:remote_project) { create(:forked_project_with_submodules) }
let(:repository) { project.repository }
let(:remote_mirror) { project.remote_mirrors.create!(url: remote_project.http_url_to_repo, enabled: true) }
......
......@@ -27,7 +27,7 @@ describe Projects::UpdateRepositoryStorageService do
end
context 'without wiki', skip_gitaly_mock: true do
let(:project) { create(:project, repository_storage: 'a', repository_read_only: true, wiki_enabled: false) }
let(:project) { create(:project, :repository, repository_storage: 'a', repository_read_only: true, wiki_enabled: false) }
context 'when the move succeeds' do
it 'moves the repository to the new storage and unmarks the repository as read only' do
......@@ -63,7 +63,7 @@ describe Projects::UpdateRepositoryStorageService do
end
context 'with wiki', skip_gitaly_mock: true do
let(:project) { create(:project, repository_storage: 'a', repository_read_only: true, wiki_enabled: true) }
let(:project) { create(:project, :repository, repository_storage: 'a', repository_read_only: true, wiki_enabled: true) }
before do
project.create_wiki
......
......@@ -137,7 +137,7 @@ describe Projects::UpdateService, '#execute' do
describe 'repository_storage' do
let(:admin_user) { create(:user, admin: true) }
let(:user) { create(:user) }
let(:project) { create(:project, repository_storage: 'a') }
let(:project) { create(:project, :repository, repository_storage: 'a') }
let(:opts) { { repository_storage: 'b' } }
before do
......
require 'spec_helper'
describe SlashCommands::GlobalSlackHandler do
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
let(:user) { create(:user) }
let(:verification_token) { '123' }
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe AdminEmailsWorker do
context "recipients" do
let(:group) { create :group }
let(:project) { create :project }
let(:project) { create :empty_project }
before do
2.times do
......
require 'spec_helper'
describe ElasticCommitIndexerWorker do
let!(:project) { create(:project) }
let!(:project) { create(:project, :repository) }
subject { described_class.new }
......
......@@ -174,7 +174,7 @@ describe ElasticIndexerWorker, elastic: true do
project, issue, milestone, note, merge_request = nil
Sidekiq::Testing.disable! do
project = create :project
project = create :project, :repository
subject.perform("index", "Project", project.id)
issue = create :issue, project: project
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe GeoRepositoryCreateWorker do
let(:user) { create :user }
let(:project) { create :project }
let(:project) { create :project, :repository }
let(:perform!) { subject.perform(project.id) }
before do
......
......@@ -4,7 +4,7 @@ describe GeoRepositoryUpdateWorker do
include RepoHelpers
let(:user) { create :user }
let(:project) { create :project }
let(:project) { create :project, :repository }
let(:blankrev) { Gitlab::Git::BLANK_SHA }
let(:oldrev) { sample_commit.parent_id }
......
require 'spec_helper'
describe ProjectUpdateRepositoryStorageWorker do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
subject { described_class.new }
......
......@@ -27,7 +27,7 @@ describe RepositoryUpdateMirrorWorker do
context 'with another worker already running' do
it 'raises UpdateAlreadyInProgressError' do
mirror = create(:project, :mirror, :import_started)
mirror = create(:project, :repository, :mirror, :import_started)
expect do
subject.perform(mirror.id)
......@@ -37,7 +37,7 @@ describe RepositoryUpdateMirrorWorker do
context 'with unexpected error' do
it 'marks mirror as failed' do
mirror = create(:project, :mirror, :import_scheduled)
mirror = create(:project, :repository, :mirror, :import_scheduled)
allow_any_instance_of(Projects::UpdateMirrorService).to receive(:execute).and_raise(RuntimeError)
......@@ -49,7 +49,7 @@ describe RepositoryUpdateMirrorWorker do
end
context 'threshold_reached?' do
let(:mirror) { create(:project, :mirror, :import_scheduled) }
let(:mirror) { create(:project, :repository, :mirror, :import_scheduled) }
before do
expect_any_instance_of(Projects::UpdateMirrorService).to receive(:execute).and_return(status: :success)
......
......@@ -3,7 +3,7 @@ require 'rails_helper'
describe RepositoryUpdateRemoteMirrorWorker do
subject { described_class.new }
let(:remote_mirror) { create(:project, :remote_mirror).remote_mirrors.first }
let(:remote_mirror) { create(:project, :repository, :remote_mirror).remote_mirrors.first }
let(:scheduled_time) { Time.now - 5.minutes }
before do
......
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