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

adding factory methods to node base class

This commit is contained in:
Aaron Patterson 2010-12-14 16:24:36 -08:00
parent fe35956bf7
commit fef5e012c9
3 changed files with 6 additions and 1 deletions

View file

@ -3,6 +3,7 @@ module Arel
###
# Abstract base class for all AST nodes
class Node
include Arel::FactoryMethods
include Enumerable
###

View file

@ -6,7 +6,7 @@ module Arel
alias :table_alias :name
def [] name
Attribute.new self, name
Attribute.new(self, name)
end
end
end

View file

@ -2,6 +2,10 @@ require 'helper'
module Arel
class TestNode < MiniTest::Unit::TestCase
def test_includes_factory_methods
assert Node.new.respond_to?(:create_join)
end
def test_all_nodes_are_nodes
Nodes.constants.map { |k|
Nodes.const_get(k)