debian-mirror-gitlab/spec/lib/banzai/filter/table_of_contents_tag_filter_spec.rb
2020-08-09 17:44:08 +05:30

24 lines
487 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Banzai::Filter::TableOfContentsTagFilter do
include FilterSpecHelper
context 'table of contents' do
let(:html) { '<p>[[<em>TOC</em>]]</p>' }
it 'replaces [[<em>TOC</em>]] with ToC result' do
doc = filter(html, {}, { toc: "FOO" })
expect(doc.to_html).to eq("FOO")
end
it 'handles an empty ToC result' do
doc = filter(html)
expect(doc.to_html).to eq ''
end
end
end