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
737 738 739 740 741 742 743 744 745 746 747 748 |
# File 'lib/mdoc.rb', line 737 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
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 |
# File 'lib/mdoc.rb', line 750 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 |