diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 10:12:40 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 10:12:40 -0800 |
commit | 34551bf31e859c4d9aeaeae2b68bf2c338558b74 (patch) | |
tree | 6bc1ec779bdef6cee39436b3519e5f0282c042c4 /activerecord/test/cases | |
parent | 5708648a77e8081d69e32ba827c8a909876dd3b9 (diff) | |
parent | efbb85c84b3c6c21232d4cf899b2d6a5542681fb (diff) | |
download | rails-34551bf31e859c4d9aeaeae2b68bf2c338558b74.tar.gz rails-34551bf31e859c4d9aeaeae2b68bf2c338558b74.tar.bz2 rails-34551bf31e859c4d9aeaeae2b68bf2c338558b74.zip |
Merge pull request #4282 from edgecase/order_after_reorder
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 |