diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-01-08 13:47:42 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-01-08 13:47:42 +0000 |
commit | b64ec38aae3e741aacd3a136eba5ccfa8053eca2 (patch) | |
tree | 12dad94dd9679b5d6522a4b57040d5ba2544b6f2 /spec | |
parent | 08213ed4f5d35b582f0345d6a825737ced98fd05 (diff) | |
parent | 4c90ed52fe6ff7b1155088c46460c411e121feb3 (diff) | |
download | gitlab-ce-b64ec38aae3e741aacd3a136eba5ccfa8053eca2.tar.gz |
Merge branch 'api-delete-tag' into 'master'
Delete tag via API
### What does this MR do?
Implements deleting a tag via the API.
### Are there points in the code the reviewer needs to double check?
On success, it returns the name of the deleted tag. This is similar to the [delete branch API](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/api/branches.rb#L111).
### What are the relevant issue numbers / Feature requests?
* This MR closes #1575
* Closes http://feedback.gitlab.com/forums/176466-general/suggestions/6599203-delete-tags-through-the-api
@stanhu Could you do a review?
See merge request !1862
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/tags_spec.rb | 21 |
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. |