diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/visitors/oracle_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/visitors/oracle_spec.rb b/spec/visitors/oracle_spec.rb index cdf0e3427f..93ade3ef3c 100644 --- a/spec/visitors/oracle_spec.rb +++ b/spec/visitors/oracle_spec.rb @@ -71,6 +71,16 @@ module Arel } end + it 'creates a subquery when there is DISTINCT' do + stmt = Nodes::SelectStatement.new + stmt.cores.first.projections << Nodes::SqlLiteral.new('DISTINCT id') + stmt.limit = 10 + sql = @visitor.accept stmt + sql.should be_like %{ + SELECT * FROM (SELECT DISTINCT id) WHERE ROWNUM <= 10 + } + end + it 'creates a different subquery when there is an offset' do stmt = Nodes::SelectStatement.new stmt.limit = 10 |