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
path: root/spec
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-03-26 16:09:37 +0300
committerLin Jen-Shin <godfat@godfat.org>2019-03-26 16:09:37 +0300
commita5c54bac4446c8c261fe1c900cf92e8d110e3301 (patch)
tree8675ee6ad7d5720470c6832eb00d59aa97d6d916 /spec
parente4760e770d5fbd04084ede92db4d80c86bc28aca (diff)
parentb27c4420c9e62ffc8cf53a4a854f4907454af400 (diff)
Merge branch 'delete-release-when-delete-tag' into 'master'
Releases are not automatically deleted when deleting corresponding tag Closes #57980 and #57380 See merge request gitlab-org/gitlab-ce!26530
Diffstat (limited to 'spec')
-rw-r--r--spec/services/releases/destroy_service_spec.rb8
-rw-r--r--spec/services/tags/destroy_service_spec.rb16
2 files changed, 19 insertions, 5 deletions
diff --git a/spec/services/releases/destroy_service_spec.rb b/spec/services/releases/destroy_service_spec.rb
index dd5b8708f36..28663ca8853 100644
--- a/spec/services/releases/destroy_service_spec.rb
+++ b/spec/services/releases/destroy_service_spec.rb
@@ -28,13 +28,11 @@ describe Releases::DestroyService do
end
end
- context 'when tag is not found' do
+ context 'when tag does not exist in the repository' do
let(:tag) { 'v1.1.1' }
- it 'returns an error' do
- is_expected.to include(status: :error,
- message: 'Tag does not exist',
- http_status: 404)
+ it 'removes the orphaned release' do
+ expect { subject }.to change { project.releases.count }.by(-1)
end
end
diff --git a/spec/services/tags/destroy_service_spec.rb b/spec/services/tags/destroy_service_spec.rb
index 7c8c1dd0d3a..a541d300595 100644
--- a/spec/services/tags/destroy_service_spec.rb
+++ b/spec/services/tags/destroy_service_spec.rb
@@ -7,11 +7,27 @@ describe Tags::DestroyService do
let(:service) { described_class.new(project, user) }
describe '#execute' do
+ subject { service.execute(tag_name) }
+
it 'removes the tag' do
expect(repository).to receive(:before_remove_tag)
expect(service).to receive(:success)
service.execute('v1.1.0')
end
+
+ context 'when there is an associated release on the tag' do
+ let(:tag) { repository.tags.first }
+ let(:tag_name) { tag.name }
+
+ before do
+ project.add_maintainer(user)
+ create(:release, tag: tag_name, project: project)
+ end
+
+ it 'destroys the release' do
+ expect { subject }.to change { project.releases.count }.by(-1)
+ end
+ end
end
end