diff options
Diffstat (limited to 'activerecord/test/cases/associations/eager_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index bf01b46852..20c6b691fc 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -592,7 +592,6 @@ class EagerAssociationTest < ActiveRecord::TestCase # gets raw row hashes from the database and then instantiates them, this test ensures that # it only instantiates one actual object per record from the database. def test_has_and_belongs_to_many_should_not_instantiate_same_records_multiple_times - welcome = posts(:welcome) categories = Category.includes(:posts) general = categories.find { |c| c == categories(:general) } @@ -916,6 +915,12 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal 3, Developer.find(:all, :include => 'projects', :conditions => 'developers_projects.access_level = 1', :limit => 5).size end + def test_dont_create_temporary_active_record_instances + Developer.instance_count = 0 + developers = Developer.find(:all, :include => 'projects', :conditions => 'developers_projects.access_level = 1', :limit => 5).to_a + assert_equal developers.count, Developer.instance_count + end + def test_order_on_join_table_with_include_and_limit assert_equal 5, Developer.find(:all, :include => 'projects', :order => 'developers_projects.joined_on DESC', :limit => 5).size end |