diff options
author | Matt Jones + Scott Walker <pairing+mj+sw@gmail.com> | 2012-01-03 14:52:36 -0500 |
---|---|---|
committer | Matt Jones + Scott Walker <pairing+mj+sw@gmail.com> | 2012-01-03 14:52:36 -0500 |
commit | efbb85c84b3c6c21232d4cf899b2d6a5542681fb (patch) | |
tree | bfa97545425ab7a75e4ff536b2558efd106963da /activerecord/test/cases | |
parent | 9f76659bb8cbef1fb409e1dc1ae8e7edc6006208 (diff) | |
download | rails-efbb85c84b3c6c21232d4cf899b2d6a5542681fb.tar.gz rails-efbb85c84b3c6c21232d4cf899b2d6a5542681fb.tar.bz2 rails-efbb85c84b3c6c21232d4cf899b2d6a5542681fb.zip |
correctly handle order calls after a reorder
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relation_scoping_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/relation_test.rb | 2 |
2 files changed, 7 insertions, 1 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 diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb index 15cb7aec07..e9a3b0419c 100644 --- a/activerecord/test/cases/relation_test.rb +++ b/activerecord/test/cases/relation_test.rb @@ -20,7 +20,7 @@ module ActiveRecord end def test_single_values - assert_equal [:limit, :offset, :lock, :readonly, :from, :reorder, :reverse_order, :uniq].map(&:to_s).sort, + assert_equal [:limit, :offset, :lock, :readonly, :from, :reordering, :reverse_order, :uniq].map(&:to_s).sort, Relation::SINGLE_VALUE_METHODS.map(&:to_s).sort end |