From 52d0b7338852fcc5cccfe5282d68ee058c62b4ed Mon Sep 17 00:00:00 2001 From: Michael Batchelor Date: Fri, 19 Aug 2016 16:37:45 -0700 Subject: remove union mapping as :binary node when performing DepthFirst enumeration --- test/attributes/test_attribute.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/attributes/test_attribute.rb') 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]) -- cgit v1.2.3