Commit 61fe0a23 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Fixed WikiPipeline and specs

parent 28266d9d
...@@ -4,7 +4,7 @@ module Banzai ...@@ -4,7 +4,7 @@ module Banzai
def self.filters def self.filters
@filters ||= begin @filters ||= begin
super.insert_after(Filter::TableOfContentsFilter, Filter::GollumTagsFilter) super.insert_after(Filter::TableOfContentsFilter, Filter::GollumTagsFilter)
.insert_after(Filter::GollumTagsFilter, Filter::WikiLinkFilter) .insert_after(Filter::TableOfContentsFilter, Filter::WikiLinkFilter)
end end
end end
end end
......
require 'rails_helper' require 'rails_helper'
describe Banzai::Pipeline::WikiPipeline do describe Banzai::Pipeline::WikiPipeline do
let(:project_wiki) { double }
before(:each) { allow(project_wiki).to receive(:wiki_base_path) { '/some/repo/wikis' } }
describe 'TableOfContents' do describe 'TableOfContents' do
it 'replaces the tag with the TableOfContentsFilter result' do it 'replaces the tag with the TableOfContentsFilter result' do
markdown = <<-MD.strip_heredoc markdown = <<-MD.strip_heredoc
...@@ -11,7 +14,7 @@ describe Banzai::Pipeline::WikiPipeline do ...@@ -11,7 +14,7 @@ describe Banzai::Pipeline::WikiPipeline do
Foo Foo
MD MD
result = described_class.call(markdown, project: spy, project_wiki: double) result = described_class.call(markdown, project: spy, project_wiki: project_wiki)
aggregate_failures do aggregate_failures do
expect(result[:output].text).not_to include '[[' expect(result[:output].text).not_to include '[['
...@@ -29,7 +32,7 @@ describe Banzai::Pipeline::WikiPipeline do ...@@ -29,7 +32,7 @@ describe Banzai::Pipeline::WikiPipeline do
Foo Foo
MD MD
output = described_class.to_html(markdown, project: spy, project_wiki: double) output = described_class.to_html(markdown, project: spy, project_wiki: project_wiki)
expect(output).to include('[[<em>toc</em>]]') expect(output).to include('[[<em>toc</em>]]')
end end
...@@ -42,7 +45,7 @@ describe Banzai::Pipeline::WikiPipeline do ...@@ -42,7 +45,7 @@ describe Banzai::Pipeline::WikiPipeline do
Foo Foo
MD MD
output = described_class.to_html(markdown, project: spy, project_wiki: double) output = described_class.to_html(markdown, project: spy, project_wiki: project_wiki)
aggregate_failures do aggregate_failures do
expect(output).not_to include('<ul>') expect(output).not_to include('<ul>')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment