diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2015-05-13 01:07:48 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2015-05-18 20:48:03 +0200 |
commit | 8dbc4746fe7c723b67f3c90cbf40fd7bf6c29cb7 (patch) | |
tree | 268aba3884c8e2e09fdefda9cad7a4c569154cc2 /spec/helpers | |
parent | dc348baf18240dc05e209ec781daada2cbcfe16f (diff) | |
download | gitlab-ce-8dbc4746fe7c723b67f3c90cbf40fd7bf6c29cb7.tar.gz |
Handle AsciiDoc better, reuse HTML pipeline filters (fixes #9263)
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 9 | ||||
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index d4cf6540080..59870dfb192 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -261,12 +261,19 @@ describe ApplicationHelper do end end - describe 'markup_render' do + describe 'render_markup' do let(:content) { 'Noël' } it 'should preserve encoding' do expect(content.encoding.name).to eq('UTF-8') expect(render_markup('foo.rst', content).encoding.name).to eq('UTF-8') end + + it "should delegate to #asciidoc when file name corresponds to AsciiDoc" do + expect(self).to receive(:asciidoc?).with('foo.adoc').and_return(true) + expect(self).to receive(:asciidoc).and_return('NOEL') + + expect(render_markup('foo.adoc', content)).to eq('NOEL') + end end end diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 9f3e8cf585e..0d0418f84a7 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -110,6 +110,14 @@ describe GitlabMarkdownHelper do helper.render_wiki_content(@wiki) end + it "should use Asciidoctor for asciidoc files" do + allow(@wiki).to receive(:format).and_return(:asciidoc) + + expect(helper).to receive(:asciidoc).with('wiki content') + + helper.render_wiki_content(@wiki) + end + it "should use the Gollum renderer for all other file types" do allow(@wiki).to receive(:format).and_return(:rdoc) formatted_content_stub = double('formatted_content') |