diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-06-29 01:02:18 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-06-29 01:19:04 +0900 |
commit | daec73aa429c37ea3c10d7628922697665776127 (patch) | |
tree | e2a3f590f1f78426482f141a15b84829f24c857f /activerecord/test/cases/associations | |
parent | bf7606d4ebae24e7ba49e34190c21cbad0a98640 (diff) | |
download | rails-daec73aa429c37ea3c10d7628922697665776127.tar.gz rails-daec73aa429c37ea3c10d7628922697665776127.tar.bz2 rails-daec73aa429c37ea3c10d7628922697665776127.zip |
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.
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 5 |
1 files 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 |