Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 15:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 15:09:17 +0300
commitcd52759ee33051b8ad7b88b02ba7954e4fad7018 (patch)
treef1096c68e457aef7f5201acd16e4a751ff538026 /spec/lib/api
parent18f7828977b74bf6e5153594a098ef90e773b3b7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/api')
-rw-r--r--spec/lib/api/entities/release_spec.rb32
1 files changed, 28 insertions, 4 deletions
diff --git a/spec/lib/api/entities/release_spec.rb b/spec/lib/api/entities/release_spec.rb
index 729a69347cb..f0bbaa35efe 100644
--- a/spec/lib/api/entities/release_spec.rb
+++ b/spec/lib/api/entities/release_spec.rb
@@ -4,13 +4,14 @@ require 'spec_helper'
describe API::Entities::Release do
let_it_be(:project) { create(:project) }
- let_it_be(:release) { create(:release, :with_evidence, project: project) }
- let(:user) { create(:user) }
+ let_it_be(:user) { create(:user) }
let(:entity) { described_class.new(release, current_user: user) }
- subject { entity.as_json }
-
describe 'evidence' do
+ let(:release) { create(:release, :with_evidence, project: project) }
+
+ subject { entity.as_json }
+
context 'when the current user can download code' do
it 'exposes the evidence sha and the json path' do
allow(Ability).to receive(:allowed?).and_call_original
@@ -37,4 +38,27 @@ describe API::Entities::Release do
end
end
end
+
+ describe 'description_html' do
+ let(:issue) { create(:issue, :confidential, project: project) }
+ let(:issue_path) { Gitlab::Routing.url_helpers.project_issue_path(project, issue) }
+ let(:issue_title) { 'title="%s"' % issue.title }
+ let(:release) { create(:release, project: project, description: "Now shipping #{issue.to_reference}") }
+
+ subject(:description_html) { entity.as_json[:description_html] }
+
+ it 'renders special references if current user has access' do
+ project.add_reporter(user)
+
+ expect(description_html).to include(issue_path)
+ expect(description_html).to include(issue_title)
+ end
+
+ it 'does not render special references if current user has no access' do
+ project.add_guest(user)
+
+ expect(description_html).not_to include(issue_path)
+ expect(description_html).not_to include(issue_title)
+ end
+ end
end