test/tree_test.rb in hirb-0.2.5 vs test/tree_test.rb in hirb-0.2.6

- old
+ new

@@ -149,9 +149,21 @@ `-- 4.1 TREE root = mock_node(['0.0', ['1.1', ['2.1', '3.2'], '4.1']], :blah) Hirb::Helpers::ParentChildTree.render(root, :type=>:directory, :value_method=>:blah).should == expected_tree end + + test "with children_method proc option renders" do + expected_tree = <<-TREE.unindent + 1 + |-- 2 + |-- 3 + |-- 4 + `-- 5 + TREE + Hirb::Helpers::ParentChildTree.render(1, :type=>:directory, + :children_method=>lambda {|e| e == 1 ? (2..5).to_a : []}, :value_method=>:to_s) + end end test "tree with parentless nodes renders ParentlessNodeError" do assert_raises(Hirb::Helpers::Tree::ParentlessNodeError) { tree([[0, "0.0"], [2, '1.2']], :validate=>true) } end