2010-12-14 01:16:29 -05:00
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
module Arel
|
|
|
|
module FactoryMethods
|
|
|
|
class TestFactoryMethods < MiniTest::Unit::TestCase
|
|
|
|
class Factory
|
|
|
|
include Arel::FactoryMethods
|
|
|
|
end
|
|
|
|
|
|
|
|
def setup
|
|
|
|
@factory = Factory.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_create_join
|
2010-12-14 12:43:19 -05:00
|
|
|
join = @factory.create_join :one, :two
|
2010-12-14 01:16:29 -05:00
|
|
|
assert_kind_of Nodes::Join, join
|
2010-12-14 23:31:49 -05:00
|
|
|
assert_equal :two, join.right
|
2010-12-14 01:16:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_create_on
|
|
|
|
on = @factory.create_on :one
|
|
|
|
assert_instance_of Nodes::On, on
|
|
|
|
assert_equal :one, on.expr
|
|
|
|
end
|
2011-04-25 15:01:22 -04:00
|
|
|
|
2011-05-30 23:40:11 -04:00
|
|
|
def test_create_true
|
|
|
|
true_node = @factory.create_true
|
|
|
|
assert_instance_of Nodes::True, true_node
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_create_false
|
|
|
|
false_node = @factory.create_false
|
|
|
|
assert_instance_of Nodes::False, false_node
|
|
|
|
end
|
|
|
|
|
2011-04-25 15:01:22 -04:00
|
|
|
def test_lower
|
|
|
|
lower = @factory.lower :one
|
|
|
|
assert_instance_of Nodes::NamedFunction, lower
|
|
|
|
assert_equal 'LOWER', lower.name
|
|
|
|
assert_equal [:one], lower.expressions
|
|
|
|
end
|
2010-12-14 01:16:29 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|