diff options
author | Brett Walker <bwalker@gitlab.com> | 2018-08-17 10:19:09 -0500 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2018-09-05 09:19:16 -0500 |
commit | e41b99943230240403bdca7b19d5f379892cd819 (patch) | |
tree | 79dc5e6c885cd1051b96e56642328d1ba1561ec7 /spec/lib/banzai | |
parent | 5a7451c2f91e5ed7fa95f6abb5eaceaf220945cb (diff) | |
download | gitlab-ce-e41b99943230240403bdca7b19d5f379892cd819.tar.gz |
test that wiki links with spaces works in wiki pipeline
Diffstat (limited to 'spec/lib/banzai')
-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 |