diff options
Diffstat (limited to 'spec/services/ci/destroy_pipeline_service_spec.rb')
-rw-r--r-- | spec/services/ci/destroy_pipeline_service_spec.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/services/ci/destroy_pipeline_service_spec.rb b/spec/services/ci/destroy_pipeline_service_spec.rb index 6977c99e335..302233cea5a 100644 --- a/spec/services/ci/destroy_pipeline_service_spec.rb +++ b/spec/services/ci/destroy_pipeline_service_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' RSpec.describe ::Ci::DestroyPipelineService do - let(:project) { create(:project, :repository) } + let_it_be(:project) { create(:project, :repository) } + let!(:pipeline) { create(:ci_pipeline, :success, project: project, sha: project.commit.id) } subject { described_class.new(project, user).execute(pipeline) } @@ -17,13 +18,16 @@ RSpec.describe ::Ci::DestroyPipelineService do expect { pipeline.reload }.to raise_error(ActiveRecord::RecordNotFound) end - it 'clears the cache', :use_clean_rails_memory_store_caching do + it 'clears the cache', :use_clean_rails_redis_caching do create(:commit_status, :success, pipeline: pipeline, ref: pipeline.ref) expect(project.pipeline_status.has_status?).to be_truthy subject + # We need to reset lazy_latest_pipeline cache to simulate a new request + BatchLoader::Executor.clear_current + # Need to use find to avoid memoization expect(Project.find(project.id).pipeline_status.has_status?).to be_falsey end @@ -57,6 +61,10 @@ RSpec.describe ::Ci::DestroyPipelineService do expect { artifact.reload }.to raise_error(ActiveRecord::RecordNotFound) end + + it 'inserts deleted objects for object storage files' do + expect { subject }.to change { Ci::DeletedObject.count } + end end end end |