aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation_scoping_test.rb
diff options
context:
space:
mode:
authorMatt Jones + Scott Walker <pairing+mj+sw@gmail.com>2012-01-03 14:52:36 -0500
committerMatt Jones + Scott Walker <pairing+mj+sw@gmail.com>2012-01-03 14:52:36 -0500
commitefbb85c84b3c6c21232d4cf899b2d6a5542681fb (patch)
treebfa97545425ab7a75e4ff536b2558efd106963da /activerecord/test/cases/relation_scoping_test.rb
parent9f76659bb8cbef1fb409e1dc1ae8e7edc6006208 (diff)
downloadrails-efbb85c84b3c6c21232d4cf899b2d6a5542681fb.tar.gz
rails-efbb85c84b3c6c21232d4cf899b2d6a5542681fb.tar.bz2
rails-efbb85c84b3c6c21232d4cf899b2d6a5542681fb.zip
correctly handle order calls after a reorder
Diffstat (limited to 'activerecord/test/cases/relation_scoping_test.rb')
-rw-r--r--activerecord/test/cases/relation_scoping_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation_scoping_test.rb b/activerecord/test/cases/relation_scoping_test.rb
index 8b4638b161..c65d073835 100644
--- a/activerecord/test/cases/relation_scoping_test.rb
+++ b/activerecord/test/cases/relation_scoping_test.rb
@@ -421,6 +421,12 @@ class DefaultScopingTest < ActiveRecord::TestCase
assert_equal expected, received
end
+ def test_order_after_reorder_combines_orders
+ expected = Developer.order('name DESC, id DESC').collect { |dev| [dev.name, dev.id] }
+ received = Developer.order('name ASC').reorder('name DESC').order('id DESC').collect { |dev| [dev.name, dev.id] }
+ assert_equal expected, received
+ end
+
def test_nested_exclusive_scope
expected = Developer.find(:all, :limit => 100).collect { |dev| dev.salary }
received = DeveloperOrderedBySalary.send(:with_exclusive_scope, :find => { :limit => 100 }) do