1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/test/visitors/test_ibm_db.rb
2011-11-19 18:57:36 -08:00

27 lines
734 B
Ruby

require 'helper'
module Arel
module Visitors
describe 'the ibm_db visitor' do
before do
@visitor = IBM_DB.new Table.engine.connection
end
it 'uses FETCH FIRST n ROWS to limit results' do
stmt = Nodes::SelectStatement.new
stmt.limit = Nodes::Limit.new(1)
sql = @visitor.accept(stmt)
sql.must_be_like "SELECT FETCH FIRST 1 ROWS ONLY"
end
it 'uses FETCH FIRST n ROWS 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 'id' FETCH FIRST 1 ROWS ONLY)"
end
end
end
end