diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 09:07:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 09:07:58 +0300 |
commit | 9c83aadd2604e7e6cb1f84683f951e6b12872618 (patch) | |
tree | c0a14c87378e832e87580be382e1c8ccea188b71 /spec/models/deployment_spec.rb | |
parent | 23bc19cb73aad969c9636b8b935111645e809e54 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r-- | spec/models/deployment_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 86dfa586862..6eb006a5d67 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -623,4 +623,26 @@ describe Deployment do expect(deploy.errors[:ref]).not_to be_empty end end + + describe '.fast_destroy_all' do + it 'cleans path_refs for destroyed environments' do + project = create(:project, :repository) + environment = create(:environment, project: project) + + destroyed_deployments = create_list(:deployment, 2, :success, environment: environment, project: project) + other_deployments = create_list(:deployment, 2, :success, environment: environment, project: project) + + (destroyed_deployments + other_deployments).each(&:create_ref) + + described_class.where(id: destroyed_deployments.map(&:id)).fast_destroy_all + + destroyed_deployments.each do |deployment| + expect(project.commit(deployment.ref_path)).to be_nil + end + + other_deployments.each do |deployment| + expect(project.commit(deployment.ref_path)).not_to be_nil + end + end + end end |