diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-28 12:07:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-28 12:07:59 +0300 |
commit | 94f0f0e4b9fa3f49bf6145100b206c36c0c4eef6 (patch) | |
tree | 312acc67554de704dfe734619e20a8453b8c3ab2 /spec/workers | |
parent | deacfcd2fcccfbcf76fb07b26a2710579fd5e17a (diff) |
Add latest changes from gitlab-org/gitlab@16-6-stable-ee
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb b/spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb index b4ee1d6b439..e2687e7cd9a 100644 --- a/spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb +++ b/spec/workers/pages/deactivated_deployments_delete_cron_worker_spec.rb @@ -5,11 +5,14 @@ require 'spec_helper' RSpec.describe Pages::DeactivatedDeploymentsDeleteCronWorker, feature_category: :pages do subject(:worker) { described_class.new } - it 'deletes all deactivated pages deployments' do - create(:pages_deployment) # active - create(:pages_deployment, deleted_at: 3.minutes.ago) # deactivated - create(:pages_deployment, path_prefix: 'other', deleted_at: 3.minutes.ago) # deactivated + let!(:pages_deployment) { create(:pages_deployment) } + let!(:deactivated_pages_deployment) { create(:pages_deployment, deleted_at: 3.minutes.ago) } + let!(:alt_deactivated_pages_deployment) { create(:pages_deployment, path_prefix: 'other', deleted_at: 3.minutes.ago) } + + it 'deletes all deactivated pages deployments and their files from the filesystem' do + file_paths = [deactivated_pages_deployment.file.path, alt_deactivated_pages_deployment.file.path] expect { worker.perform }.to change { PagesDeployment.count }.by(-2) + .and change { (file_paths.any? { |path| File.exist?(path) }) }.from(true).to(false) end end |