diff options
Diffstat (limited to 'test/nodes/test_node.rb')
-rw-r--r-- | test/nodes/test_node.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/nodes/test_node.rb b/test/nodes/test_node.rb new file mode 100644 index 0000000000..71d2098a60 --- /dev/null +++ b/test/nodes/test_node.rb @@ -0,0 +1,33 @@ +require 'helper' + +module Arel + class TestNode < MiniTest::Unit::TestCase + def test_all_nodes_are_nodes + Nodes.constants.map { |k| + Nodes.const_get(k) + }.grep(Class).each do |klass| + next if Nodes::SqlLiteral == klass + assert klass.ancestors.include?(Nodes::Node), klass.name + end + end + + def test_each + list = [] + node = Nodes::Node.new + node.each { |n| list << n } + assert_equal [node], list + end + + def test_generator + list = [] + node = Nodes::Node.new + node.each.each { |n| list << n } + assert_equal [node], list + end + + def test_enumerable + node = Nodes::Node.new + assert_kind_of Enumerable, node + end + end +end |