forked from nkallen/arel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a basic test for the informix visitor
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |