From 21e052796d3007488d5dd9f00299a3a22fdb6249 Mon Sep 17 00:00:00 2001
From: Ernie Miller <ernie@metautonomo.us>
Date: Wed, 9 Mar 2011 02:27:43 +0800
Subject: Replace MathOperation with InfixOperation to support more operators

---
 test/visitors/test_to_sql.rb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'test/visitors')

diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index c47fd57a28..25ff7be3e2 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -194,7 +194,7 @@ module Arel
         end
       end
 
-      describe "Nodes::MathOperation" do
+      describe "Nodes::InfixOperation" do
         it "should handle Multiplication" do
           node = Arel::Attributes::Decimal.new(Table.new(:products), :price) * Arel::Attributes::Decimal.new(Table.new(:currency_rates), :rate)
           @visitor.accept(node).must_equal %("products"."price" * "currency_rates"."rate")
@@ -214,6 +214,15 @@ module Arel
           node = Arel::Attributes::Decimal.new(Table.new(:products), :price) - 7
           @visitor.accept(node).must_equal %(("products"."price" - 7))
         end
+
+        it "should handle arbitrary operators" do
+          node = Arel::Nodes::InfixOperation.new(
+            '||',
+            Arel::Attributes::String.new(Table.new(:products), :name),
+            Arel::Attributes::String.new(Table.new(:products), :name)
+          )
+          @visitor.accept(node).must_equal %("products"."name" || "products"."name")
+        end
       end
 
       describe "Nodes::NotIn" do
-- 
cgit v1.2.3