diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-24 10:09:21 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-24 10:09:21 -0700 |
commit | f63badf42738c4a553e84e3d121786000c67c623 (patch) | |
tree | f5094cb2a931c89977fa3dd6953b4c66aeb49bc9 /spec/arel/visitors | |
parent | 487df1771ded1fb065a53ebe9d1a5a9c119478e3 (diff) | |
download | rails-f63badf42738c4a553e84e3d121786000c67c623.tar.gz rails-f63badf42738c4a553e84e3d121786000c67c623.tar.bz2 rails-f63badf42738c4a553e84e3d121786000c67c623.zip |
creating a subquery when there is an order and a limit
Diffstat (limited to 'spec/arel/visitors')
-rw-r--r-- | spec/arel/visitors/oracle_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/arel/visitors/oracle_spec.rb b/spec/arel/visitors/oracle_spec.rb index 384725b788..87a1c378ac 100644 --- a/spec/arel/visitors/oracle_spec.rb +++ b/spec/arel/visitors/oracle_spec.rb @@ -15,6 +15,16 @@ module Arel sql = @visitor.accept stmt sql.should be_like %{ SELECT WHERE ROWNUM <= 10 } end + + it 'creates a subquery when there is order_by' do + stmt = Nodes::SelectStatement.new + stmt.orders << Nodes::SqlLiteral.new('foo') + stmt.limit = 10 + sql = @visitor.accept stmt + sql.should be_like %{ + SELECT * FROM (SELECT ORDER BY foo) WHERE ROWNUM <= 10 + } + end end end end |