diff options
author | Brett Walker <bwalker@gitlab.com> | 2018-09-08 04:21:30 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-09-08 04:21:30 +0000 |
commit | 1d4785470db018d46fc247d1d11e12aa25352c08 (patch) | |
tree | c78be9d59d176ef0a5ba42d570b799209f1f4156 /spec | |
parent | 6d1b5850342a91ebdff07bb57722ce28e31b773f (diff) | |
download | gitlab-ce-1d4785470db018d46fc247d1d11e12aa25352c08.tar.gz |
Resolve "Process urls with spaces in all markdown processing"
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/issuables_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/banzai/pipeline/gfm_pipeline_spec.rb | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index f76ed4bfda4..4af98bc3678 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -184,7 +184,7 @@ describe IssuablesHelper do issuableRef: "##{issue.iid}", markdownPreviewPath: "/#{@project.full_path}/preview_markdown", markdownDocsPath: '/help/user/markdown', - markdownVersion: 11, + markdownVersion: CacheMarkdownField::CACHE_COMMONMARK_VERSION, issuableTemplates: [], projectPath: @project.path, projectNamespace: @project.namespace.path, diff --git a/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb b/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb index 75413596431..df24cef0b8b 100644 --- a/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb +++ b/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb @@ -87,4 +87,22 @@ describe Banzai::Pipeline::GfmPipeline do end end end + + describe 'markdown link or image urls having spaces' do + let(:project) { create(:project, :public) } + + it 'rewrites links with spaces in url' do + markdown = "[Link to Page](page slug)" + output = described_class.to_html(markdown, project: project) + + expect(output).to include("href=\"page%20slug\"") + end + + it 'rewrites images with spaces in url' do + markdown = "![My Image](test image.png)" + output = described_class.to_html(markdown, project: project) + + expect(output).to include("src=\"test%20image.png\"") + end + end end |