Commit 2b8bc704 authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Heinrich Lee Yu

Replace set with let_it_in in spec/workers

Removes usage of `set` in specs
parent 427bce1a
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe DetectRepositoryLanguagesWorker do describe DetectRepositoryLanguagesWorker do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
subject { described_class.new } subject { described_class.new }
......
...@@ -31,7 +31,7 @@ describe ExpireBuildInstanceArtifactsWorker do ...@@ -31,7 +31,7 @@ describe ExpireBuildInstanceArtifactsWorker do
end end
context 'with not yet expired artifacts' do context 'with not yet expired artifacts' do
set(:build) do let_it_be(:build) do
create(:ci_build, :artifacts, artifacts_expire_at: Time.now + 7.days) create(:ci_build, :artifacts, artifacts_expire_at: Time.now + 7.days)
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe ExpireJobCacheWorker do describe ExpireJobCacheWorker do
set(:pipeline) { create(:ci_empty_pipeline) } let_it_be(:pipeline) { create(:ci_empty_pipeline) }
let(:project) { pipeline.project } let(:project) { pipeline.project }
describe '#perform' do describe '#perform' do
......
...@@ -6,7 +6,7 @@ describe MailScheduler::NotificationServiceWorker do ...@@ -6,7 +6,7 @@ describe MailScheduler::NotificationServiceWorker do
let(:worker) { described_class.new } let(:worker) { described_class.new }
let(:method) { 'new_key' } let(:method) { 'new_key' }
set(:key) { create(:personal_key) } let_it_be(:key) { create(:personal_key) }
def serialize(*args) def serialize(*args)
ActiveJob::Arguments.serialize(args) ActiveJob::Arguments.serialize(args)
......
...@@ -7,8 +7,8 @@ describe PipelineScheduleWorker do ...@@ -7,8 +7,8 @@ describe PipelineScheduleWorker do
subject { described_class.new.perform } subject { described_class.new.perform }
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let!(:pipeline_schedule) do let!(:pipeline_schedule) do
create(:ci_pipeline_schedule, :nightly, project: project, owner: user) create(:ci_pipeline_schedule, :nightly, project: project, owner: user)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe RemoteMirrorNotificationWorker, :mailer do describe RemoteMirrorNotificationWorker, :mailer do
set(:project) { create(:project, :repository, :remote_mirror) } let_it_be(:project) { create(:project, :repository, :remote_mirror) }
set(:mirror) { project.remote_mirrors.first } let_it_be(:mirror) { project.remote_mirrors.first }
describe '#execute' do describe '#execute' do
it 'calls NotificationService#remote_mirror_update_failed when the mirror exists' do it 'calls NotificationService#remote_mirror_update_failed when the mirror exists' do
......
...@@ -4,9 +4,9 @@ require 'spec_helper' ...@@ -4,9 +4,9 @@ require 'spec_helper'
describe RunPipelineScheduleWorker do describe RunPipelineScheduleWorker do
describe '#perform' do describe '#perform' do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project ) } let_it_be(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project ) }
let(:worker) { described_class.new } let(:worker) { described_class.new }
context 'when a project not found' do context 'when a project not found' do
......
...@@ -4,8 +4,8 @@ require 'spec_helper' ...@@ -4,8 +4,8 @@ require 'spec_helper'
describe UpdateExternalPullRequestsWorker do describe UpdateExternalPullRequestsWorker do
describe '#perform' do describe '#perform' do
set(:project) { create(:project, import_source: 'tanuki/repository') } let_it_be(:project) { create(:project, import_source: 'tanuki/repository') }
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:worker) { described_class.new } let(:worker) { described_class.new }
before do 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