spec/pipeline_spec.rb in mdoc-0.0.8 vs spec/pipeline_spec.rb in mdoc-0.0.9

- old
+ new

@@ -28,28 +28,31 @@ [ProcA, 'proc_b'] end end end - class Writer - class NilWriter < Writer - def process!(doc); end + class NilWriter < Writer + def process!(doc); end + + def default_processors + [] end end end describe Mdoc::Pipeline do context 'pre_processor' do subject(:doc) do Mdoc.convert!('spec/fixtures/multikeys.md') do |pl| pl.insert('proc_wrap') - pl.writer = Mdoc::Writer::NilWriter + pl.writer = Mdoc::NilWriter end end it 'perform 3 processors' do - doc.performed.size.should eq(3 + Mdoc.default_processors.size) + ps = Mdoc.default_processors(Mdoc::Writer).size + doc.performed.size.should eq(3 + ps) doc.performed[Mdoc::Processor::ProcB].should eq(1) end end context 'insert' do @@ -61,11 +64,12 @@ end end it 'perform 5 processors' do doc.is_a?(Mdoc::Document::Kramdown).should be_true - doc.performed.size.should eq(5 + Mdoc.default_processors.size) + ps = Mdoc.default_processors(Mdoc::Writer).size + doc.performed.size.should eq(5 + ps) doc.performed[Mdoc::Processor::ProcD].should eq(1) doc.performed[Mdoc::Processor::ProcC].should eq(1) doc.body.should eq('c') # d insert before c end end @@ -78,10 +82,10 @@ pl.append('proc_r') pl.append('proc_r') pl.append('proc_b') pl.insert('proc_d', { after: 'proc_b' }) pl.remove(['proc_b']) - pl.writer = Mdoc::Writer::NilWriter + pl.writer = Mdoc::NilWriter end end it 'repeat only for proc_r' do doc.is_a?(Mdoc::Document).should be_true