diff options
author | Brett Walker <bwalker@gitlab.com> | 2018-08-17 10:19:09 -0500 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2018-08-20 08:26:16 -0500 |
commit | 466e384e4c020fe9d9c5e7753abf5804342c7a14 (patch) | |
tree | 0fbb9da020bbc7d62582b17088576ad06dc348a2 | |
parent | 6065bbdbafd30e39331e40aa354945441538e64e (diff) | |
download | gitlab-ce-bw-commonmark-for-files.tar.gz |
test that wiki links with spaces works in wiki pipelinebw-commonmark-for-files
-rw-r--r-- | spec/lib/banzai/pipeline/wiki_pipeline_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb b/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb index 88ae4c1e07a..52b8c9be647 100644 --- a/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb +++ b/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb @@ -121,6 +121,13 @@ describe Banzai::Pipeline::WikiPipeline do expect(output).to include("href=\"#{relative_url_root}/wiki_link_ns/wiki_link_project/wikis/page\"") end + it 'rewrites non-file links (with spaces) to be at the scope of the wiki root' do + markdown = "[Link to Page](page slug)" + output = described_class.to_html(markdown, project: project, project_wiki: project_wiki, page_slug: page.slug) + + expect(output).to include("href=\"#{relative_url_root}/wiki_link_ns/wiki_link_project/wikis/page%20slug\"") + end + it "rewrites file links to be at the scope of the current directory" do markdown = "[Link to Page](page.md)" output = described_class.to_html(markdown, project: project, project_wiki: project_wiki, page_slug: page.slug) @@ -134,6 +141,13 @@ describe Banzai::Pipeline::WikiPipeline do expect(output).to include("href=\"#{relative_url_root}/wiki_link_ns/wiki_link_project/wikis/start-page#title\"") end + + it 'rewrites links (with spaces) with anchor' do + markdown = '[Link to Header](start page#title)' + output = described_class.to_html(markdown, project: project, project_wiki: project_wiki, page_slug: page.slug) + + expect(output).to include("href=\"#{relative_url_root}/wiki_link_ns/wiki_link_project/wikis/start%20page#title\"") + end end describe "when creating root links" do |