aboutsummaryrefslogtreecommitdiffstats
path: root/test/nodes/test_named_function.rb
diff options
context:
space:
mode:
authorErnie Miller <ernie@metautonomo.us>2011-04-29 13:36:22 -0400
committerAaron Patterson <aaron.patterson@gmail.com>2011-04-29 11:13:41 -0700
commit7361b6cbd5e4c6f03198ed42eed4e3dd4feb149e (patch)
treefdc15b45bcc57407e7192ba2e9db537ad871b94e /test/nodes/test_named_function.rb
parentd09a882329e8eeebac89e907289c537077f81d44 (diff)
downloadrails-7361b6cbd5e4c6f03198ed42eed4e3dd4feb149e.tar.gz
rails-7361b6cbd5e4c6f03198ed42eed4e3dd4feb149e.tar.bz2
rails-7361b6cbd5e4c6f03198ed42eed4e3dd4feb149e.zip
Move #as to AliasPredication, stop overriding Function's #as.
Diffstat (limited to 'test/nodes/test_named_function.rb')
-rw-r--r--test/nodes/test_named_function.rb17
1 files changed, 17 insertions, 0 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