From daec73aa429c37ea3c10d7628922697665776127 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 29 Jun 2017 01:02:18 +0900 Subject: Add a test case for unscoping `default_scope` in associations Unscoping `default_scope` in associations has already supported (#17360 for preloading, c9cf8b8 for eager loading). Fixes #20679. Closes #16531. --- activerecord/test/cases/associations/has_many_associations_test.rb | 5 +++-- 1 file changed, 3 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 169e1a5449..dab3d1b740 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -2354,8 +2354,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase car = Car.create! bulb = Bulb.create! name: "other", car: car - assert_equal bulb, Car.find(car.id).all_bulbs.first - assert_equal bulb, Car.includes(:all_bulbs).find(car.id).all_bulbs.first + assert_equal [bulb], Car.find(car.id).all_bulbs + assert_equal [bulb], Car.includes(:all_bulbs).find(car.id).all_bulbs + assert_equal [bulb], Car.eager_load(:all_bulbs).find(car.id).all_bulbs end test "raises RecordNotDestroyed when replaced child can't be destroyed" do -- cgit v1.2.3