提交 69df47c7 编写于 作者: S Shinya Maeda

Improve spec

上级 e8e8ae4d
......@@ -6,28 +6,31 @@ describe StuckCiJobsWorker do
let(:worker) { described_class.new }
let(:exclusive_lease_uuid) { SecureRandom.uuid }
subject do
job.reload
job.status
end
before do
job.update!(status: status, updated_at: updated_at)
allow_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).and_return(exclusive_lease_uuid)
end
shared_examples 'job is dropped' do
it 'changes status' do
before do
worker.perform
is_expected.to eq('failed')
job.reload
end
it "changes status" do
expect(job).to be_failed
expect(job).to be_stuck_or_timeout_failure
end
end
shared_examples 'job is unchanged' do
it "doesn't change status" do
before do
worker.perform
is_expected.to eq(status)
job.reload
end
it "doesn't change status" do
expect(job.status).to eq(status)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册