summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-01-08 10:10:04 +0100
committerRobert Schilling <rschilling@student.tugraz.at>2016-01-08 10:10:04 +0100
commit4c90ed52fe6ff7b1155088c46460c411e121feb3 (patch)
treec37c4109b8086f0848703d39efeffcbaff0b6ac1 /spec/requests/api
parente78ddb09733beced9d4d34e8f68966f18210bef7 (diff)
downloadgitlab-ce-4c90ed52fe6ff7b1155088c46460c411e121feb3.tar.gz
Delete tag via APIapi-delete-tag
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/tags_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb
index 17f2643fd45..f966e38cd3e 100644
--- a/spec/requests/api/tags_spec.rb
+++ b/spec/requests/api/tags_spec.rb
@@ -65,6 +65,27 @@ describe API::API, api: true do
end
end
+ describe 'DELETE /projects/:id/repository/tags/:tag_name' do
+ let(:tag_name) { project.repository.tag_names.sort.reverse.first }
+
+ before do
+ allow_any_instance_of(Repository).to receive(:rm_tag).and_return(true)
+ end
+
+ context 'delete tag' do
+ it 'should delete an existing tag' do
+ delete api("/projects/#{project.id}/repository/tags/#{tag_name}", user)
+ expect(response.status).to eq(200)
+ expect(json_response['tag_name']).to eq(tag_name)
+ end
+
+ it 'should raise 404 if the tag does not exist' do
+ delete api("/projects/#{project.id}/repository/tags/foobar", user)
+ expect(response.status).to eq(404)
+ end
+ end
+ end
+
context 'annotated tag' do
it 'should create a new annotated tag' do
# Identity must be set in .gitconfig to create annotated tag.