require 'forwardable'
module DocTest
describe HTML::Converter do
extend Forwardable
def_delegator :converter, :convert_examples
subject(:converter) { described_class.new }
describe '#convert_examples' do
let(:input) { Example.new 's:dummy', content: '*chunky* bacon' }
let(:output) { Example.new 's:dummy', content: 'chunky bacon', opts: opts }
let(:opts) { {dummy: 'value'} }
let(:converter_opts) { {header_footer: false} }
subject(:result) { convert_examples input, output }
let :rendered do
<<-EOF
Chunky baconTitle
meh
why?
Chunkybacon
why?
' end end context 'with :header_footer option' do let(:opts) { {header_footer: true} } let(:converter_opts) { {header_footer: true} } it 'renders content with :header_footer => true' do convert_examples input, output end end context 'with example named /^document.*/' do let(:input) { Example.new 'document:dummy', content: '*chunky* bacon' } let(:converter_opts) { {header_footer: true} } it 'renders content with :header_footer => true' do convert_examples input, output end end context 'with example named /inline_.*/' do let(:input) { Example.new 'inline_quoted:dummy', content: '*chunky* bacon' } let(:rendered) { 'chunky bacon
' } it 'returns content without top-leveltags' do expect(result.first).to eq 'chunky bacon' end context 'with :include option' do let(:opts) { {include: ['.//b']} } it 'preferes the include option' do expect(result.first).to eq 'chunky' end end end end end end