Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

failing test for reorder overriding default_scope

[5528]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
commit 16e078d908b79c78016e3a08afdd18a3dc77d40b 1 parent 91fec0d
Nick Ragaz nragaz authored spastorino committed
6 activerecord/test/cases/relation_scoping_test.rb
View
@@ -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
2  activerecord/test/models/developer.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.