diff options
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/method_scoping_test.rb | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index aea6aed8d9..1441b4278d 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -1865,7 +1865,9 @@ class BasicsTest < ActiveRecord::TestCase end assert scoped_developers.include?(developers(:poor_jamis)) assert scoped_developers.include?(developers(:david)) - assert scoped_developers.include?(developers(:dev_10)) + assert ! scoped_developers.include?(developers(:jamis)) + assert_equal 3, scoped_developers.size + # Test without scoped find conditions to ensure we get the right thing developers = Developer.find(:all, :order => 'id', :limit => 1) assert scoped_developers.include?(developers(:david)) diff --git a/activerecord/test/cases/method_scoping_test.rb b/activerecord/test/cases/method_scoping_test.rb index 26aa3ed8d5..a502b50c3e 100644 --- a/activerecord/test/cases/method_scoping_test.rb +++ b/activerecord/test/cases/method_scoping_test.rb @@ -625,21 +625,21 @@ class DefaultScopingTest < ActiveRecord::TestCase end def test_method_scope - expected = Developer.find(:all, :order => 'name DESC, salary DESC').collect { |dev| dev.salary } + expected = Developer.find(:all, :order => 'name DESC').collect { |dev| dev.salary } received = DeveloperOrderedBySalary.all_ordered_by_name.collect { |dev| dev.salary } assert_equal expected, received end def test_nested_scope - expected = Developer.find(:all, :order => 'name DESC, salary DESC').collect { |dev| dev.salary } + expected = Developer.find(:all, :order => 'name DESC').collect { |dev| dev.salary } received = DeveloperOrderedBySalary.send(:with_scope, :find => { :order => 'name DESC'}) do DeveloperOrderedBySalary.find(:all).collect { |dev| dev.salary } end assert_equal expected, received end - def test_named_scope_order_appended_to_default_scope_order - expected = Developer.find(:all, :order => 'name DESC, salary DESC').collect { |dev| dev.name } + def test_named_scope_overwrites_default + expected = Developer.find(:all, :order => 'name DESC').collect { |dev| dev.name } received = DeveloperOrderedBySalary.by_name.find(:all).collect { |dev| dev.name } assert_equal expected, received end |