From ca6e7f71da7ed23aa723adb6611bf1fbb06e2137 Mon Sep 17 00:00:00 2001 From: Martin Little <mlittle@tempusfactor.com> Date: Mon, 16 May 2011 09:24:04 -0400 Subject: Added a basic test for the informix visitor --- test/visitors/test_informix.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/visitors/test_informix.rb (limited to 'test/visitors') diff --git a/test/visitors/test_informix.rb b/test/visitors/test_informix.rb new file mode 100644 index 0000000000..db5e52b8a4 --- /dev/null +++ b/test/visitors/test_informix.rb @@ -0,0 +1,34 @@ +require 'helper' + +module Arel + module Visitors + describe 'the informix visitor' do + before do + @visitor = Informix.new Table.engine + end + + it 'uses LIMIT n to limit results' do + stmt = Nodes::SelectStatement.new + stmt.limit = Nodes::Limit.new(1) + sql = @visitor.accept(stmt) + sql.must_be_like "SELECT LIMIT 1" + end + + it 'uses LIMIT n in updates with a limit' do + stmt = Nodes::UpdateStatement.new + stmt.limit = Nodes::Limit.new(1) + stmt.key = 'id' + sql = @visitor.accept(stmt) + sql.must_be_like "UPDATE NULL WHERE 'id' IN (SELECT LIMIT 1 'id')" + end + + it 'uses SKIP n to jump results' do + stmt = Nodes::SelectStatement.new + stmt.offset = Nodes::Offset.new(10) + sql = @visitor.accept(stmt) + sql.must_be_like "SELECT SKIP 10" + end + + end + end +end -- cgit v1.2.3