aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-07-20 14:00:06 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-07-20 14:00:06 -0700
commit2567b72f9582c14a591156653e2b656d48200b11 (patch)
tree3f0b89b8ccc8ccc37f5233ca628d550b3cc6ec9a /test
parent7832cd3bb3c6cfd76fdb63ca75995f2e6c87757c (diff)
downloadrails-2567b72f9582c14a591156653e2b656d48200b11.tar.gz
rails-2567b72f9582c14a591156653e2b656d48200b11.tar.bz2
rails-2567b72f9582c14a591156653e2b656d48200b11.zip
supressing nested parenthesis in multiple unions on mysql. thanks jhtwong. fixes #58
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_mysql.rb10
1 files changed, 10 insertions, 0 deletions
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