Class: MarkdownExec::TestMDoc2
- Defined in:
- lib/mdoc.rb
Instance Method Summary collapse
-
#setup ⇒ Object
Mocking the @table object for testing.
- #test_collect_wrapped_blocks ⇒ Object
Instance Method Details
#setup ⇒ Object
Mocking the @table object for testing
650 651 652 653 654 655 656 657 658 659 660 661 |
# File 'lib/mdoc.rb', line 650 def setup @table = [ FCB.new(oname: '{wrap1}'), FCB.new(oname: '{wrap2-before}'), FCB.new(oname: '{wrap2}'), FCB.new(oname: '{wrap2-after}'), FCB.new(oname: '{wrap3-before}'), FCB.new(oname: '{wrap3}'), FCB.new(oname: '{wrap3-after}') ] @mdoc = MDoc.new(@table) end |
#test_collect_wrapped_blocks ⇒ Object
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
# File 'lib/mdoc.rb', line 663 def test_collect_wrapped_blocks # Test case 1: blocks with wraps assert_equal(%w[{wrap2-before} {wrap2} b {wrap2-after}], @mdoc.collect_wrapped_blocks( [FCB.new(oname: 'b', wraps: ['{wrap2}'])] ).map(&:oname)) assert_equal(%w[{wrap2-before} {wrap2} {wrap3-before} {wrap3} c {wrap3-after} {wrap2-after}], @mdoc.collect_wrapped_blocks( [OpenStruct.new(oname: 'c', wraps: %w[{wrap2} {wrap3}])] ).map(&:oname)) # Test case 2: blocks with no wraps blocks = @mdoc.collect_wrapped_blocks([]) assert_empty blocks # Test case 3: blocks with missing wraps assert_equal( %w[block4], @mdoc.collect_wrapped_blocks( [OpenStruct.new(oname: 'block4', wraps: ['wrap4'])] ).map(&:oname) ) end |