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