summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2015-11-21 22:24:34 +0100
committerRobert Schilling <rschilling@student.tugraz.at>2015-11-21 22:24:34 +0100
commit3ea05c5b5b253de33d8bf8d615c66e2935b940ef (patch)
tree486d420d9c21ebe85b5b296685a9328179cb41dd /spec
parent6f7e90f6dba300591281aba08ffbe30ce3cc5c90 (diff)
downloadgitlab-ce-3ea05c5b5b253de33d8bf8d615c66e2935b940ef.tar.gz
Only allow to create a release if it does not exist yet
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/tags_spec.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb
index 0ee819ae445..0a456fc3b5d 100644
--- a/spec/requests/api/tags_spec.rb
+++ b/spec/requests/api/tags_spec.rb
@@ -28,10 +28,10 @@ describe API::API, api: true do
before do
release = project.releases.find_or_initialize_by(tag: tag_name)
release.update_attributes(description: description)
- get api("/projects/#{project.id}/repository/tags", user)
end
it "should return an array of project tags with release info" do
+ get api("/projects/#{project.id}/repository/tags", user)
expect(response.status).to eq(200)
expect(json_response).to be_an Array
expect(json_response.first['name']).to eq(tag_name)
@@ -139,5 +139,20 @@ describe API::API, api: true do
expect(response.status).to eq(404)
expect(json_response['message']).to eq('Tag does not exist')
end
+
+ context 'on tag with existing release' do
+ before do
+ release = project.releases.find_or_initialize_by(tag: tag_name)
+ release.update_attributes(description: description)
+ end
+
+ it 'should return 409 if there is already a release' do
+ post api("/projects/#{project.id}/repository/tags/#{tag_name}/release", user),
+ description: description
+
+ expect(response.status).to eq(409)
+ expect(json_response['message']).to eq('Release already exists')
+ end
+ end
end
end