diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2015-11-22 00:24:34 +0300 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2015-11-22 00:24:34 +0300 |
commit | 3ea05c5b5b253de33d8bf8d615c66e2935b940ef (patch) | |
tree | 486d420d9c21ebe85b5b296685a9328179cb41dd /spec/requests/api/tags_spec.rb | |
parent | 6f7e90f6dba300591281aba08ffbe30ce3cc5c90 (diff) |
Only allow to create a release if it does not exist yet
Diffstat (limited to 'spec/requests/api/tags_spec.rb')
-rw-r--r-- | spec/requests/api/tags_spec.rb | 17 |
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 |