diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index <HASH>..<HASH> 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -143,6 +143,15 @@ module Arel
           }
         end
 
+        it 'can handle subqueries' do
+          table = Table.new(:users)
+          subquery = table.project(:id).where(table[:name].eq('Aaron'))
+          node = @attr.in subquery
+          @visitor.accept(node).must_be_like %{
+            "users"."id" IN (SELECT id FROM "users" WHERE "users"."name" = 'Aaron')
+          }
+        end
+
         it 'uses the same column for escaping values' do
         @attr = Table.new(:users)[:name]
           visitor = Class.new(ToSql) do
@@ -189,6 +198,15 @@ module Arel
           }
         end
 
+        it 'can handle subqueries' do
+          table = Table.new(:users)
+          subquery = table.project(:id).where(table[:name].eq('Aaron'))
+          node = @attr.not_in subquery
+          @visitor.accept(node).must_be_like %{
+            "users"."id" NOT IN (SELECT id FROM "users" WHERE "users"."name" = 'Aaron')
+          }
+        end
+
         it 'uses the same column for escaping values' do
         @attr = Table.new(:users)[:name]
           visitor = Class.new(ToSql) do
tests for passing a subquery to #in and #not_in