Commit 68e67189 authored by Robert Speicher's avatar Robert Speicher

Use `:empty_project` where possible in worker specs

parent 985a0c39
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe DeleteMergedBranchesWorker do
subject(:worker) { described_class.new }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
describe "#perform" do
it "calls DeleteMergedBranchesService" do
......
......@@ -5,7 +5,7 @@ describe EmailsOnPushWorker do
include EmailHelpers
include EmailSpec::Matchers
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:data) { Gitlab::DataBuilder::Push.build_sample(project, user) }
let(:recipients) { user.email }
......
......@@ -3,7 +3,7 @@ require 'fileutils'
require 'spec_helper'
describe GitGarbageCollectWorker do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:shell) { Gitlab::Shell.new }
subject { GitGarbageCollectWorker.new }
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe GroupDestroyWorker do
let(:group) { create(:group) }
let(:user) { create(:admin) }
let!(:project) { create(:project, namespace: group) }
let!(:project) { create(:empty_project, namespace: group) }
subject { GroupDestroyWorker.new }
......
require 'spec_helper'
describe PipelineMetricsWorker do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let!(:merge_request) { create(:merge_request, source_project: project, source_branch: pipeline.ref) }
let(:pipeline) do
......
......@@ -11,7 +11,7 @@ describe PipelineNotificationWorker do
status: status)
end
let(:project) { create(:project, public_builds: false) }
let(:project) { create(:project, :repository, public_builds: false) }
let(:user) { create(:user) }
let(:pusher) { user }
let(:watcher) { pusher }
......
......@@ -4,7 +4,7 @@ describe PostReceive do
let(:changes) { "123456 789012 refs/heads/tést\n654321 210987 refs/tags/tag" }
let(:wrongly_encoded_changes) { changes.encode("ISO-8859-1").force_encoding("UTF-8") }
let(:base64_changes) { Base64.encode64(wrongly_encoded_changes) }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:key) { create(:key, user: project.owner) }
let(:key_id) { key.shell_id }
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe ProcessCommitWorker do
let(:worker) { described_class.new }
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let(:project) { create(:project, :public, :repository) }
let(:issue) { create(:issue, project: project, author: user) }
let(:commit) { project.commit }
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe ProjectCacheWorker do
let(:worker) { described_class.new }
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:statistics) { project.statistics }
describe '#perform' do
......
require 'spec_helper'
describe ProjectDestroyWorker do
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:path) { project.repository.path_to_repo }
subject { ProjectDestroyWorker.new }
......
......@@ -4,7 +4,7 @@ describe RepositoryCheck::BatchWorker do
subject { described_class.new }
it 'prefers projects that have never been checked' do
projects = create_list(:project, 3, created_at: 1.week.ago)
projects = create_list(:empty_project, 3, created_at: 1.week.ago)
projects[0].update_column(:last_repository_check_at, 4.months.ago)
projects[2].update_column(:last_repository_check_at, 3.months.ago)
......@@ -12,7 +12,7 @@ describe RepositoryCheck::BatchWorker do
end
it 'sorts projects by last_repository_check_at' do
projects = create_list(:project, 3, created_at: 1.week.ago)
projects = create_list(:empty_project, 3, created_at: 1.week.ago)
projects[0].update_column(:last_repository_check_at, 2.months.ago)
projects[1].update_column(:last_repository_check_at, 4.months.ago)
projects[2].update_column(:last_repository_check_at, 3.months.ago)
......@@ -21,7 +21,7 @@ describe RepositoryCheck::BatchWorker do
end
it 'excludes projects that were checked recently' do
projects = create_list(:project, 3, created_at: 1.week.ago)
projects = create_list(:empty_project, 3, created_at: 1.week.ago)
projects[0].update_column(:last_repository_check_at, 2.days.ago)
projects[1].update_column(:last_repository_check_at, 2.months.ago)
projects[2].update_column(:last_repository_check_at, 3.days.ago)
......@@ -40,7 +40,7 @@ describe RepositoryCheck::BatchWorker do
it 'skips projects created less than 24 hours ago' do
project = create(:empty_project)
project.update_column(:created_at, 23.hours.ago)
expect(subject.perform).to eq([])
end
end
require 'spec_helper'
describe RepositoryForkWorker do
let(:project) { create(:project) }
let(:fork_project) { create(:project, forked_from_project: project) }
let(:project) { create(:project, :repository) }
let(:fork_project) { create(:project, :repository, forked_from_project: project) }
let(:shell) { Gitlab::Shell.new }
subject { RepositoryForkWorker.new }
......
require 'spec_helper'
describe RepositoryImportWorker do
let(:project) { create(:project) }
let(:project) { create(:empty_project) }
subject { described_class.new }
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe UpdateMergeRequestsWorker do
include RepoHelpers
let(:project) { create(:project) }
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
subject { described_class.new }
......
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