diff options
Diffstat (limited to 'spec/models/ci/processable_spec.rb')
-rw-r--r-- | spec/models/ci/processable_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/models/ci/processable_spec.rb b/spec/models/ci/processable_spec.rb index 0a43f785598..ac1a8247aaa 100644 --- a/spec/models/ci/processable_spec.rb +++ b/spec/models/ci/processable_spec.rb @@ -147,13 +147,20 @@ RSpec.describe Ci::Processable do end it 'releases a resource when build finished' do - expect(build.resource_group).to receive(:release_resource_from).with(build).and_call_original + expect(build.resource_group).to receive(:release_resource_from).with(build).and_return(true).and_call_original expect(Ci::ResourceGroups::AssignResourceFromResourceGroupWorker).to receive(:perform_async).with(build.resource_group_id) build.enqueue_waiting_for_resource! build.success! end + it 're-checks the resource group even if the processable does not retain a resource' do + expect(build.resource_group).to receive(:release_resource_from).with(build).and_return(false).and_call_original + expect(Ci::ResourceGroups::AssignResourceFromResourceGroupWorker).to receive(:perform_async).with(build.resource_group_id) + + build.success! + end + context 'when build has prerequisites' do before do allow(build).to receive(:any_unmet_prerequisites?) { true } |