diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-16 15:09:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-16 15:09:12 +0300 |
commit | cbfe03ae04a52d9825ff7cbeccdfe5d313adf6a2 (patch) | |
tree | e4879b35d019d3bbba1689f3ac4c48b81bf7b451 /spec/requests/api/releases_spec.rb | |
parent | 3fd97b4bba24ca412112aad025a38a32c7a6cf8c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/releases_spec.rb')
-rw-r--r-- | spec/requests/api/releases_spec.rb | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/spec/requests/api/releases_spec.rb b/spec/requests/api/releases_spec.rb index 4eb6e87c254..41999ca6e60 100644 --- a/spec/requests/api/releases_spec.rb +++ b/spec/requests/api/releases_spec.rb @@ -406,6 +406,22 @@ describe API::Releases do expect(project.releases.last.description).to eq('Super nice release') end + it 'creates a new release without description' do + params = { + name: 'New release without description', + tag_name: 'v0.1', + released_at: '2019-03-25 10:00:00' + } + + expect do + post api("/projects/#{project.id}/releases", maintainer), params: params + end.to change { Release.count }.by(1) + + expect(project.releases.last.name).to eq('New release without description') + expect(project.releases.last.tag).to eq('v0.1') + expect(project.releases.last.description).to eq(nil) + end + it 'sets the released_at to the current time if the released_at parameter is not provided' do now = Time.zone.parse('2015-08-25 06:00:00Z') Timecop.freeze(now) do @@ -451,26 +467,6 @@ describe API::Releases do expect(project.releases.last.released_at).to eq('2019-03-25T01:00:00Z') end - context 'when description is empty' do - let(:params) do - { - name: 'New release', - tag_name: 'v0.1', - description: '' - } - end - - it 'returns an error as validation failure' do - expect do - post api("/projects/#{project.id}/releases", maintainer), params: params - end.not_to change { Release.count } - - expect(response).to have_gitlab_http_status(:bad_request) - expect(json_response['message']) - .to eq("Validation failed: Description can't be blank") - end - end - it 'matches response schema' do post api("/projects/#{project.id}/releases", maintainer), params: params |