diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-09-22 21:35:35 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-22 21:35:35 +0200 |
commit | 638bd19c7fdf4a4c09bfa5b4ada23c6f37724f9b (patch) | |
tree | c27414d94e86b396fe716e031a6fafb0fc8ca575 /activerecord/test/cases/associations | |
parent | 5795c509a7c0ab9c6d3d707f34526430e58e535c (diff) | |
parent | 5f86451a4c5d0beca5a746c4708be48b13f665be (diff) | |
download | rails-638bd19c7fdf4a4c09bfa5b4ada23c6f37724f9b.tar.gz rails-638bd19c7fdf4a4c09bfa5b4ada23c6f37724f9b.tar.bz2 rails-638bd19c7fdf4a4c09bfa5b4ada23c6f37724f9b.zip |
Merge branch 'patches' into multibyte
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb index 9981f4c5d5..c1d4ea8b50 100644 --- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb @@ -253,7 +253,7 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase assert !devel.projects.loaded? assert_equal devel.projects.last, proj - assert devel.projects.loaded? + assert !devel.projects.loaded? assert !proj.new_record? assert_equal Developer.find(1).projects.sort_by(&:id).last, proj # prove join table is updated diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index ba750b266c..9d550916d7 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1009,6 +1009,19 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert firm.clients.loaded? end + def test_calling_first_or_last_on_existing_record_with_create_should_not_load_association + firm = companies(:first_firm) + firm.clients.create(:name => 'Foo') + assert !firm.clients.loaded? + + assert_queries 2 do + firm.clients.first + firm.clients.last + end + + assert !firm.clients.loaded? + end + def test_calling_first_or_last_on_new_record_should_not_run_queries firm = Firm.new |