diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/nodes/test_named_function.rb | 17 | ||||
-rw-r--r-- | test/visitors/test_depth_first.rb | 6 |
2 files changed, 20 insertions, 3 deletions
diff --git a/test/nodes/test_named_function.rb b/test/nodes/test_named_function.rb index 18ecdd2851..3e0b2c3972 100644 --- a/test/nodes/test_named_function.rb +++ b/test/nodes/test_named_function.rb @@ -8,6 +8,23 @@ module Arel assert_equal 'omg', function.name assert_equal 'zomg', function.expressions end + + def test_function_alias + function = NamedFunction.new 'omg', 'zomg' + function = function.as('wth') + assert_equal 'omg', function.name + assert_equal 'zomg', function.expressions + assert_kind_of SqlLiteral, function.alias + assert_equal 'wth', function.alias + end + + def test_construct_with_alias + function = NamedFunction.new 'omg', 'zomg', 'wth' + assert_equal 'omg', function.name + assert_equal 'zomg', function.expressions + assert_kind_of SqlLiteral, function.alias + assert_equal 'wth', function.alias + end end end end diff --git a/test/visitors/test_depth_first.rb b/test/visitors/test_depth_first.rb index 06e7bba9fb..e078d4add5 100644 --- a/test/visitors/test_depth_first.rb +++ b/test/visitors/test_depth_first.rb @@ -52,14 +52,14 @@ module Arel define_method("test_#{klass.name.gsub('::', '_')}") do func = klass.new(:a, :b) @visitor.accept func - assert_equal [:a, :b, false, func], @collector.calls + assert_equal [:a, "b", false, func], @collector.calls end end def test_named_function func = Arel::Nodes::NamedFunction.new(:a, :b, :c) @visitor.accept func - assert_equal [:a, :b, false, :c, func], @collector.calls + assert_equal [:a, :b, false, "c", func], @collector.calls end def test_lock @@ -71,7 +71,7 @@ module Arel def test_count count = Nodes::Count.new :a, :b, :c @visitor.accept count - assert_equal [:a, :c, :b, count], @collector.calls + assert_equal [:a, "c", :b, count], @collector.calls end def test_inner_join |