aboutsummaryrefslogtreecommitdiffstats
path: root/test/attributes/test_attribute.rb
diff options
context:
space:
mode:
authorMichael Batchelor <batchelor@nationbuilder.com>2016-08-19 16:37:45 -0700
committerMichael Batchelor <batchelor@nationbuilder.com>2016-08-19 16:37:45 -0700
commit52d0b7338852fcc5cccfe5282d68ee058c62b4ed (patch)
tree4cd6b2f8f762017d0c115a3d083ce7e5c8e2b735 /test/attributes/test_attribute.rb
parent09827f361d4bc73e6ff157d9feb74a465e4e4cdd (diff)
downloadrails-52d0b7338852fcc5cccfe5282d68ee058c62b4ed.tar.gz
rails-52d0b7338852fcc5cccfe5282d68ee058c62b4ed.tar.bz2
rails-52d0b7338852fcc5cccfe5282d68ee058c62b4ed.zip
remove union mapping as :binary node when performing DepthFirst enumeration
Diffstat (limited to 'test/attributes/test_attribute.rb')
-rw-r--r--test/attributes/test_attribute.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/attributes/test_attribute.rb b/test/attributes/test_attribute.rb
index 4e55069df4..f6b73adf6a 100644
--- a/test/attributes/test_attribute.rb
+++ b/test/attributes/test_attribute.rb
@@ -834,6 +834,18 @@ module Arel
node.must_equal Nodes::NotIn.new(attribute, mgr.ast)
end
+ it 'can be constructed with a Union' do
+ relation = Table.new(:users)
+ mgr1 = relation.project(relation[:id])
+ mgr2 = relation.project(relation[:id])
+
+ union = mgr1.union(mgr2)
+ node = relation[:id].in(union)
+ node.to_sql.must_be_like %{
+ "users"."id" IN (( SELECT "users"."id" FROM "users" UNION SELECT "users"."id" FROM "users" ))
+ }
+ end
+
it 'can be constructed with a list' do
attribute = Attribute.new nil, nil
node = attribute.not_in([1, 2, 3])