summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/application_helper_spec.rb9
-rw-r--r--spec/helpers/gitlab_markdown_helper_spec.rb8
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')