From 416ad003716bcc883c319ec30644bab8a3cf52c7 Mon Sep 17 00:00:00 2001
From: Sergey Alekseev <sergey.alekseev.minsk@gmail.com>
Date: Mon, 26 May 2014 16:27:57 +0300
Subject: Wrap nested Nodes::Grouping in brackets only once

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

(limited to 'test')

diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index 05e75b5e0d..738bbe9626 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -131,6 +131,13 @@ module Arel
         end
       end
 
+      describe 'Nodes::Grouping' do
+        it 'wraps nested groupings in brackets only once' do
+          sql = compile Nodes::Grouping.new(Nodes::Grouping.new(Nodes.build_quoted('foo')))
+          sql.must_equal "('foo')"
+        end
+      end
+
       describe 'Nodes::NotEqual' do
         it 'should handle false' do
           val = Nodes.build_quoted(false, @table[:active])
-- 
cgit v1.2.3