Merge pull request #29611 from kamipo/add_test_case_for_unscoping_default_scope

Add a test case for unscoping `default_scope` in associations
This commit is contained in:
Rafael França 2017-06-28 14:32:51 -04:00 committed by GitHub
commit f94b2e8503
1 changed files with 3 additions and 2 deletions

View File

@ -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