Skip to content
Browse files

adding node test

  • Loading branch information...
1 parent 58cbd16 commit e91d393fab7d6d192ada0f51b743a2e9bca30d2a @tenderlove tenderlove committed
Showing with 33 additions and 0 deletions.
  1. +33 −0 test/nodes/test_node.rb
View
33 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

0 comments on commit e91d393

Please sign in to comment.
Something went wrong with that request. Please try again.