diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-04 20:27:34 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-04 20:27:34 -0800 |
commit | f0c4e3713d72a18a4100f85e263014f6e56bfad3 (patch) | |
tree | ccdcde4adb5ebfc4920daff19aa8ad38477b5caf /test/visitors/test_dot.rb | |
parent | dd1a65456fbfdc1f2a337aca535576d84145dcb6 (diff) | |
download | rails-f0c4e3713d72a18a4100f85e263014f6e56bfad3.tar.gz rails-f0c4e3713d72a18a4100f85e263014f6e56bfad3.tar.bz2 rails-f0c4e3713d72a18a4100f85e263014f6e56bfad3.zip |
Added Arel::Nodes::NamedFunction for representing generic SQL functions
Diffstat (limited to 'test/visitors/test_dot.rb')
-rw-r--r-- | test/visitors/test_dot.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/visitors/test_dot.rb b/test/visitors/test_dot.rb index 3c7da8958a..2909d87799 100644 --- a/test/visitors/test_dot.rb +++ b/test/visitors/test_dot.rb @@ -7,6 +7,25 @@ module Arel @visitor = Visitors::Dot.new end + # functions + [ + Nodes::Sum, + Nodes::Exists, + Nodes::Max, + Nodes::Min, + Nodes::Avg, + ].each do |klass| + define_method("test_#{klass.name.gsub('::', '_')}") do + op = klass.new(:a, :z) + @visitor.accept op + end + end + + def test_named_function + func = Nodes::NamedFunction.new 'omg', 'omg' + @visitor.accept func + end + # unary ops [ Arel::Nodes::Not, |