aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorJan De Poorter <jan@defv.be>2009-03-09 13:02:31 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-03-09 13:02:31 +0100
commit277c799d58be4b3e0e885d7b3fd6d954facc111b (patch)
treec127a63d516cf8ef7fd5ab9b495e00ae1c522ba3 /activerecord/test/cases
parent9442d843ff2ed8e7845707a95482a43aec8efe95 (diff)
downloadrails-277c799d58be4b3e0e885d7b3fd6d954facc111b.tar.gz
rails-277c799d58be4b3e0e885d7b3fd6d954facc111b.tar.bz2
rails-277c799d58be4b3e0e885d7b3fd6d954facc111b.zip
Fix find_by_last when order is given [#2127 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb4
-rw-r--r--activerecord/test/cases/reflection_test.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 3f33baf88c..b7fa9d9d7c 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -70,6 +70,10 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal 2, companies(:first_firm).limited_clients.find(:all, :limit => nil).size
end
+ def test_dynamic_find_last_without_specified_order
+ assert_equal companies(:second_client), companies(:first_firm).unsorted_clients.find_last_by_type('Client')
+ end
+
def test_dynamic_find_should_respect_association_order
assert_equal companies(:second_client), companies(:first_firm).clients_sorted_desc.find(:first, :conditions => "type = 'Client'")
assert_equal companies(:second_client), companies(:first_firm).clients_sorted_desc.find_by_type('Client')
diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb
index 34ebd99989..db64bbb806 100644
--- a/activerecord/test/cases/reflection_test.rb
+++ b/activerecord/test/cases/reflection_test.rb
@@ -170,8 +170,8 @@ class ReflectionTest < ActiveRecord::TestCase
def test_reflection_of_all_associations
# FIXME these assertions bust a lot
- assert_equal 27, Firm.reflect_on_all_associations.size
- assert_equal 20, Firm.reflect_on_all_associations(:has_many).size
+ assert_equal 28, Firm.reflect_on_all_associations.size
+ assert_equal 21, Firm.reflect_on_all_associations(:has_many).size
assert_equal 7, Firm.reflect_on_all_associations(:has_one).size
assert_equal 0, Firm.reflect_on_all_associations(:belongs_to).size
end