1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

adding node test

This commit is contained in:
Aaron Patterson 2010-11-30 11:10:30 -08:00
parent 58cbd16bb7
commit e91d393fab

33
test/nodes/test_node.rb Normal file
View file

@ -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