From 2567b72f9582c14a591156653e2b656d48200b11 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 20 Jul 2011 14:00:06 -0700 Subject: supressing nested parenthesis in multiple unions on mysql. thanks jhtwong. fixes #58 --- test/visitors/test_mysql.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/visitors/test_mysql.rb') diff --git a/test/visitors/test_mysql.rb b/test/visitors/test_mysql.rb index 3c15c218b2..8d220ac04b 100644 --- a/test/visitors/test_mysql.rb +++ b/test/visitors/test_mysql.rb @@ -7,6 +7,16 @@ module Arel @visitor = MySQL.new Table.engine end + it 'squashes parenthesis on multiple unions' do + subnode = Nodes::Union.new 'left', 'right' + node = Nodes::Union.new subnode, 'topright' + assert_equal 1, @visitor.accept(node).scan('(').length + + subnode = Nodes::Union.new 'left', 'right' + node = Nodes::Union.new 'topleft', subnode + assert_equal 1, @visitor.accept(node).scan('(').length + end + ### # :'( # http://dev.mysql.com/doc/refman/5.0/en/select.html#id3482214 -- cgit v1.2.3