aboutsummaryrefslogtreecommitdiffstats
path: root/test/visitors
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-04-08 21:14:00 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-04-08 21:14:00 -0700
commit136025996196a3c279d9d37a76ce69eb9cc7937b (patch)
treee8643ba2d9341ed35565cb9bdfe3cf0324873bcd /test/visitors
parentd3d7c218cb577919ce177f8155dc2f34d994f3cb (diff)
downloadrails-136025996196a3c279d9d37a76ce69eb9cc7937b.tar.gz
rails-136025996196a3c279d9d37a76ce69eb9cc7937b.tar.bz2
rails-136025996196a3c279d9d37a76ce69eb9cc7937b.zip
informix is working
Diffstat (limited to 'test/visitors')
-rw-r--r--test/visitors/test_informix.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/visitors/test_informix.rb b/test/visitors/test_informix.rb
index e4c2e81296..6d94282b77 100644
--- a/test/visitors/test_informix.rb
+++ b/test/visitors/test_informix.rb
@@ -7,10 +7,14 @@ module Arel
@visitor = Informix.new Table.engine.connection
end
+ def compile node
+ @visitor.accept(node, Collectors::SQLString.new).value
+ end
+
it 'uses LIMIT n to limit results' do
stmt = Nodes::SelectStatement.new
stmt.limit = Nodes::Limit.new(1)
- sql = @visitor.accept(stmt)
+ sql = compile(stmt)
sql.must_be_like "SELECT LIMIT 1"
end
@@ -20,14 +24,14 @@ module Arel
stmt.relation = table
stmt.limit = Nodes::Limit.new(Nodes.build_quoted(1))
stmt.key = table[:id]
- sql = @visitor.accept(stmt)
- sql.must_be_like "UPDATE \"users\" WHERE \"users\".\"id\" IN (SELECT LIMIT 1 \"users\".\"id\" FROM \"users\" )"
+ sql = compile(stmt)
+ sql.must_be_like "UPDATE \"users\" WHERE \"users\".\"id\" IN (SELECT LIMIT 1 \"users\".\"id\" FROM \"users\")"
end
it 'uses SKIP n to jump results' do
stmt = Nodes::SelectStatement.new
stmt.offset = Nodes::Offset.new(10)
- sql = @visitor.accept(stmt)
+ sql = compile(stmt)
sql.must_be_like "SELECT SKIP 10"
end
@@ -35,7 +39,7 @@ module Arel
stmt = Nodes::SelectStatement.new
stmt.limit = Nodes::Limit.new(1)
stmt.offset = Nodes::Offset.new(1)
- sql = @visitor.accept(stmt)
+ sql = compile(stmt)
sql.must_be_like "SELECT SKIP 1 LIMIT 1"
end
@@ -45,7 +49,7 @@ module Arel
core.source = Nodes::JoinSource.new(table, [table.create_join(Table.new(:comments))])
stmt = Nodes::SelectStatement.new([core])
- sql = @visitor.accept(stmt)
+ sql = compile(stmt)
sql.must_be_like 'SELECT FROM "posts" INNER JOIN "comments"'
end