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, 4 insertions, 3 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 94437380a4..ce1da53859 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -212,8 +212,9 @@ class EagerAssociationTest < ActiveRecord::TestCase def test_finding_with_includes_on_null_belongs_to_association_with_same_include_includes_only_once post = posts(:welcome) - post.update_attributes!(:author => nil) - post = assert_queries(1) { Post.all.merge!(:includes => {:author_with_address => :author_address}).find(post.id) } # find the post, then find the author which is null so no query for the author or address + post.update!(author: nil) + post = assert_queries(1) { Post.all.merge!(includes: {author_with_address: :author_address}).find(post.id) } + # find the post, then find the author which is null so no query for the author or address assert_no_queries do assert_equal nil, post.author_with_address end @@ -221,7 +222,7 @@ class EagerAssociationTest < ActiveRecord::TestCase def test_finding_with_includes_on_null_belongs_to_polymorphic_association sponsor = sponsors(:moustache_club_sponsor_for_groucho) - sponsor.update_attributes!(:sponsorable => nil) + sponsor.update!(sponsorable: nil) sponsor = assert_queries(1) { Sponsor.all.merge!(:includes => :sponsorable).find(sponsor.id) } assert_no_queries do assert_equal nil, sponsor.sponsorable |