spec/arel/engines/sql/unit/relations/take_spec.rb in arel-0.2.1 vs spec/arel/engines/sql/unit/relations/take_spec.rb in arel-0.3.0
- old
+ new
@@ -17,10 +17,27 @@
FROM `users`
LIMIT 4
})
end
- adapter_is_not :mysql do
+ adapter_is :oracle do
+ sql.should be_like(%Q{
+ SELECT "USERS"."ID", "USERS"."NAME"
+ FROM "USERS"
+ WHERE ROWNUM <= 4
+ })
+
+ sql_with_order_by = Take.new(@relation.order(@relation[:id]), @taken).to_sql
+ sql_with_order_by.should be_like(%Q{
+ select * from
+ (SELECT "USERS"."ID", "USERS"."NAME"
+ FROM "USERS"
+ ORDER BY "USERS"."ID" ASC)
+ where rownum <= 4
+ })
+ end
+
+ adapter_is_not :mysql, :oracle do
sql.should be_like(%Q{
SELECT "users"."id", "users"."name"
FROM "users"
LIMIT 4
})