diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-10-07 15:43:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-07 15:43:31 -0400 |
commit | 83d301f30eb95740f20d91a448b7bc407858fc72 (patch) | |
tree | ddebf8b786faa4ab604ede6ed7cbf6031f66ccb9 /test/attributes | |
parent | ea05e8e23a59421b2e2573153e1fd2a4cd4c0aca (diff) | |
parent | 52d0b7338852fcc5cccfe5282d68ee058c62b4ed (diff) | |
download | rails-83d301f30eb95740f20d91a448b7bc407858fc72.tar.gz rails-83d301f30eb95740f20d91a448b7bc407858fc72.tar.bz2 rails-83d301f30eb95740f20d91a448b7bc407858fc72.zip |
Merge pull request #443 from mgbatchelor/master
remove union mapping as :binary node when performing DepthFirst enumeration
Diffstat (limited to 'test/attributes')
-rw-r--r-- | test/attributes/test_attribute.rb | 12 |
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]) |