diff options
author | Ernie Miller <ernie@metautonomo.us> | 2011-04-29 13:36:22 -0400 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-29 11:13:41 -0700 |
commit | 7361b6cbd5e4c6f03198ed42eed4e3dd4feb149e (patch) | |
tree | fdc15b45bcc57407e7192ba2e9db537ad871b94e /test | |
parent | d09a882329e8eeebac89e907289c537077f81d44 (diff) | |
download | rails-7361b6cbd5e4c6f03198ed42eed4e3dd4feb149e.tar.gz rails-7361b6cbd5e4c6f03198ed42eed4e3dd4feb149e.tar.bz2 rails-7361b6cbd5e4c6f03198ed42eed4e3dd4feb149e.zip |
Move #as to AliasPredication, stop overriding Function's #as.
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 |