diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-07 17:47:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-07 17:47:00 +0300 |
commit | 08086ff522742c28a6b10e9b2ed71f0af6633e5b (patch) | |
tree | 5a4fde8b23140cb4edf04b24854b53f87085dd42 /spec/requests | |
parent | 8f3fbbf0d56091ad87158f61bf2a4e96a7f937e3 (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-ee
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/releases_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/requests/api/releases_spec.rb b/spec/requests/api/releases_spec.rb index 81ddcd7cf84..dad3e34404b 100644 --- a/spec/requests/api/releases_spec.rb +++ b/spec/requests/api/releases_spec.rb @@ -50,6 +50,12 @@ RSpec.describe API::Releases do expect(json_response.second['tag_name']).to eq(release_1.tag) end + it 'does not include description_html' do + get api("/projects/#{project.id}/releases", maintainer) + + expect(json_response.map { |h| h['description_html'] }).to contain_exactly(nil, nil) + end + RSpec.shared_examples 'release sorting' do |order_by| subject { get api(url, access_level), params: { sort: sort, order_by: order_by } } @@ -107,6 +113,15 @@ RSpec.describe API::Releases do expect(json_response.second['commit_path']).to eq("/#{release_1.project.full_path}/-/commit/#{release_1.commit.id}") expect(json_response.second['tag_path']).to eq("/#{release_1.project.full_path}/-/tags/#{release_1.tag}") end + + context 'when include_html_description option is true' do + it 'includes description_html field' do + get api("/projects/#{project.id}/releases", maintainer), params: { include_html_description: true } + + expect(json_response.map { |h| h['description_html'] }) + .to contain_exactly(instance_of(String), instance_of(String)) + end + end end it 'returns an upcoming_release status for a future release' do @@ -328,6 +343,12 @@ RSpec.describe API::Releases do .to match_array(release.sources.map(&:url)) end + it 'does not include description_html' do + get api("/projects/#{project.id}/releases/v0.1", maintainer) + + expect(json_response['description_html']).to eq(nil) + end + context 'with evidence' do let!(:evidence) { create(:evidence, release: release) } @@ -403,6 +424,14 @@ RSpec.describe API::Releases do end end + context 'when include_html_description option is true' do + it 'includes description_html field' do + get api("/projects/#{project.id}/releases/v0.1", maintainer), params: { include_html_description: true } + + expect(json_response['description_html']).to be_instance_of(String) + end + end + context 'when user is a guest' do it 'responds 403 Forbidden' do get api("/projects/#{project.id}/releases/v0.1", guest) |