diff options
author | Nick Ragaz <nick.ragaz@gmail.com> | 2010-09-02 00:36:18 -0400 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-09-05 08:27:51 -0300 |
commit | 16e078d908b79c78016e3a08afdd18a3dc77d40b (patch) | |
tree | 19f7bcecc5dc4407dbaa08b3aa670a0765ba8f5a | |
parent | 91fec0d24d50d3b3e90c48b2501ca913544781cc (diff) | |
download | rails-16e078d908b79c78016e3a08afdd18a3dc77d40b.tar.gz rails-16e078d908b79c78016e3a08afdd18a3dc77d40b.tar.bz2 rails-16e078d908b79c78016e3a08afdd18a3dc77d40b.zip |
failing test for reorder overriding default_scope
[5528]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
-rw-r--r-- | activerecord/test/cases/relation_scoping_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/models/developer.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 e27bb65144..f538d2a326 100644 --- a/activerecord/test/cases/relation_scoping_test.rb +++ b/activerecord/test/cases/relation_scoping_test.rb @@ -390,6 +390,12 @@ class DefaultScopingTest < ActiveRecord::TestCase 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 diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index f0d40e741b..947583af76 100644 --- a/activerecord/test/models/developer.rb +++ b/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 |