diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_select_manager.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_select_manager.rb b/test/test_select_manager.rb index 8de1520b6f..29d317e16a 100644 --- a/test/test_select_manager.rb +++ b/test/test_select_manager.rb @@ -484,6 +484,29 @@ module Arel manager = Arel::SelectManager.new Table.engine manager.order(table[:id]).must_equal manager end + + it 'has order attributes' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.project SqlLiteral.new '*' + manager.from table + manager.order table[:id].desc + manager.to_sql.must_be_like %{ + SELECT * FROM "users" ORDER BY "users"."id" DESC + } + end + + it 'has order attributes for expressions' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.project SqlLiteral.new '*' + manager.from table + manager.order table[:id].count.desc + manager.to_sql.must_be_like %{ + SELECT * FROM "users" ORDER BY COUNT("users"."id") DESC + } + end + end describe 'on' do |