summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/asciidoc_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 21:09:19 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-06 21:09:19 +0000
commit7915c41e4261719719e791602c8235574157164c (patch)
tree6c1fc8c4ad4e974878c879fcc2c7c8f7d56d0cee /spec/lib/gitlab/asciidoc_spec.rb
parent495c22d1245b6212b21b7379a542df73dfa77206 (diff)
downloadgitlab-ce-7915c41e4261719719e791602c8235574157164c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/asciidoc_spec.rb')
-rw-r--r--spec/lib/gitlab/asciidoc_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb
index c7156a500d0..24528d79fa8 100644
--- a/spec/lib/gitlab/asciidoc_spec.rb
+++ b/spec/lib/gitlab/asciidoc_spec.rb
@@ -46,6 +46,27 @@ module Gitlab
end
end
+ context "with requested path" do
+ input = <<~ADOC
+ Document name: {docname}.
+ ADOC
+
+ it "ignores {docname} when not available" do
+ expect(render(input, {})).to include(input.strip)
+ end
+
+ [
+ ['/', '', 'root'],
+ ['README', 'README', 'just a filename'],
+ ['doc/api/', '', 'a directory'],
+ ['doc/api/README.adoc', 'README', 'a complete path']
+ ].each do |path, basename, desc|
+ it "sets {docname} for #{desc}" do
+ expect(render(input, { requested_path: path })).to include(": #{basename}.")
+ end
+ end
+ end
+
context "XSS" do
items = {
'link with extra attribute' => {