diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-17 14:16:50 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-17 14:19:41 +0530 |
commit | 54a043895f904e0237a590738d494554ec555265 (patch) | |
tree | 560a6a5cec771af1d934609e785d6f4cb411dccc /activerecord/test | |
parent | f9a4300415a320e1cb01fb3806fbd3637df38183 (diff) | |
download | rails-54a043895f904e0237a590738d494554ec555265.tar.gz rails-54a043895f904e0237a590738d494554ec555265.tar.bz2 rails-54a043895f904e0237a590738d494554ec555265.zip |
Make merging of order values consistent
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 |