summaryrefslogtreecommitdiff
path: root/spec/services/ci/destroy_pipeline_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/ci/destroy_pipeline_service_spec.rb')
-rw-r--r--spec/services/ci/destroy_pipeline_service_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/ci/destroy_pipeline_service_spec.rb b/spec/services/ci/destroy_pipeline_service_spec.rb
index 302233cea5a..588ff0b1762 100644
--- a/spec/services/ci/destroy_pipeline_service_spec.rb
+++ b/spec/services/ci/destroy_pipeline_service_spec.rb
@@ -67,6 +67,30 @@ RSpec.describe ::Ci::DestroyPipelineService do
end
end
end
+
+ context 'when pipeline is in cancelable state' do
+ before do
+ allow(pipeline).to receive(:cancelable?).and_return(true)
+ end
+
+ it 'cancels the pipeline' do
+ expect(pipeline).to receive(:cancel_running)
+
+ subject
+ end
+
+ context 'when cancel_pipelines_prior_to_destroy is disabled' do
+ before do
+ stub_feature_flags(cancel_pipelines_prior_to_destroy: false)
+ end
+
+ it "doesn't cancel the pipeline" do
+ expect(pipeline).not_to receive(:cancel_running)
+
+ subject
+ end
+ end
+ end
end
context 'user is not owner' do