diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-12-12 10:17:45 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-12-12 10:17:45 +0300 |
commit | 3494cdfecb7748cca558e46c805b636b3383c299 (patch) | |
tree | 49b89ffd6b2fdc9af393492147d9c99f4aca7edf /spec | |
parent | 8d739237de2d1bcfa063be422eac71c0566a4a54 (diff) |
ActiveRecord::StaleObjectError: Attempted to update a stale object: Ci::Build
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/ci/register_job_service_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/services/ci/register_job_service_spec.rb b/spec/services/ci/register_job_service_spec.rb index 3ee59014b5b..22fb7ed7215 100644 --- a/spec/services/ci/register_job_service_spec.rb +++ b/spec/services/ci/register_job_service_spec.rb @@ -307,6 +307,19 @@ module Ci it_behaves_like 'not pick' end + + context 'when job object is staled' do + let!(:pre_stage_job) { create(:ci_build, :running, pipeline: pipeline, name: 'test', stage_idx: 0) } + + before do + allow_any_instance_of(Ci::Build).to receive(:drop!) + .and_raise(ActiveRecord::StaleObjectError.new(pending_job, :drop!)) + end + + it 'does not drop nor pick' do + expect(subject).to be_nil + end + end end shared_examples 'validation is not active' do |