提交 8cd1d5a4 编写于 作者: S Sean Griffin

Fix the test that was broken by #16445 rather than deleting it

Since the counter cache was properly being updated, the model became
stale. Simply reloading the model before attempting to destroy is
sufficient for this case. I believe this is enough of an edge case to be
a valid change to the tests, even though it represents a potential
breaking change.
上级 0ed096dd
......@@ -263,6 +263,18 @@ def test_update_without_attributes_does_not_only_update_lock_version
end
end
def test_polymorphic_destroy_with_dependencies_and_lock_version
car = Car.create!
assert_difference 'car.wheels.count' do
car.wheels << Wheel.create!
end
assert_difference 'car.wheels.count', -1 do
car.reload.destroy
end
assert car.destroyed?
end
def test_removing_has_and_belongs_to_many_associations_upon_destroy
p = RichPerson.create! first_name: 'Jon'
p.treasures.create!
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册