Skip to content
Browse files

failing test for reorder overriding default_scope

[5528]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent 1c7a754 commit 02daf68e6a49509cddf5454144ee1ce319995694 @nragaz nragaz committed with spastorino Sep 2, 2010
Showing with 7 additions and 1 deletion.
  1. +6 −0 activerecord/test/cases/relation_scoping_test.rb
  2. +1 −1 activerecord/test/models/developer.rb
View
6 activerecord/test/cases/relation_scoping_test.rb
@@ -390,6 +390,12 @@ def test_reorder_overrides_default_scope_order
assert_equal expected, received
end
+ def test_reordered_scope_overrides_default_scope_order
+ not_expected = DeveloperOrderedBySalary.first # Jamis -> name DESC
+ received = DeveloperOrderedBySalary.reordered_by_name.first # David -> name
+ assert not_expected.id != received.id
+ 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
View
2 activerecord/test/models/developer.rb
@@ -88,7 +88,7 @@ class DeveloperOrderedBySalary < ActiveRecord::Base
self.table_name = 'developers'
default_scope :order => 'salary DESC'
scope :by_name, order('name DESC')
- scope :reordered_by_name, reorder('name DESC')
+ scope :reordered_by_name, reorder('name')
def self.all_ordered_by_name
with_scope(:find => { :order => 'name DESC' }) do

0 comments on commit 02daf68

Please sign in to comment.
Something went wrong with that request. Please try again.