Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/releases/destroy_service_spec.rb')
-rw-r--r--spec/services/releases/destroy_service_spec.rb28
1 files changed, 22 insertions, 6 deletions
diff --git a/spec/services/releases/destroy_service_spec.rb b/spec/services/releases/destroy_service_spec.rb
index 953490ac379..2b6e96a781e 100644
--- a/spec/services/releases/destroy_service_spec.rb
+++ b/spec/services/releases/destroy_service_spec.rb
@@ -28,6 +28,26 @@ RSpec.describe Releases::DestroyService, feature_category: :release_orchestratio
it 'returns the destroyed object' do
is_expected.to include(status: :success, release: release)
end
+
+ context 'when the release is for a catalog resource' do
+ let!(:catalog_resource) { create(:ci_catalog_resource, project: project, state: 'published') }
+ let!(:version) { create(:ci_catalog_resource_version, catalog_resource: catalog_resource, release: release) }
+
+ it 'does not update the catalog resources if there are still releases' do
+ second_release = create(:release, project: project, tag: 'v1.2.0')
+ create(:ci_catalog_resource_version, catalog_resource: catalog_resource, release: second_release)
+
+ subject
+
+ expect(catalog_resource.reload.state).to eq('published')
+ end
+
+ it 'updates the catalog resource if there are no more releases' do
+ subject
+
+ expect(catalog_resource.reload.state).to eq('draft')
+ end
+ end
end
context 'when tag does not exist in the repository' do
@@ -42,9 +62,7 @@ RSpec.describe Releases::DestroyService, feature_category: :release_orchestratio
let!(:release) {}
it 'returns an error' do
- is_expected.to include(status: :error,
- message: 'Release does not exist',
- http_status: 404)
+ is_expected.to include(status: :error, message: 'Release does not exist', http_status: 404)
end
end
@@ -52,9 +70,7 @@ RSpec.describe Releases::DestroyService, feature_category: :release_orchestratio
let(:user) { repoter }
it 'returns an error' do
- is_expected.to include(status: :error,
- message: 'Access Denied',
- http_status: 403)
+ is_expected.to include(status: :error, message: 'Access Denied', http_status: 403)
end
end