diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-03 14:02:47 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-03 14:02:47 -0800 |
commit | 7985f64e25980369bcf66b326310743cd028dbea (patch) | |
tree | a4be6748d98915d717db77e0e76deebe4b494ad8 /activerecord/test/cases | |
parent | d1230a8cd0ddcf0497ffe294548549c2ab0bef1c (diff) | |
parent | 5d2bf4d12985ba92079178787ea47d4e3992a747 (diff) | |
download | rails-7985f64e25980369bcf66b326310743cd028dbea.tar.gz rails-7985f64e25980369bcf66b326310743cd028dbea.tar.bz2 rails-7985f64e25980369bcf66b326310743cd028dbea.zip |
Merge pull request #2955 from dmitry/master
Polymorphic with optimistic lock and counter cache should be destroyed
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/locking_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index f7ee83998d..65cd9f9755 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -6,6 +6,9 @@ require 'models/reader' require 'models/legacy_thing' require 'models/reference' require 'models/string_key_object' +require 'models/car' +require 'models/engine' +require 'models/wheel' class LockWithoutDefault < ActiveRecord::Base; end @@ -224,6 +227,15 @@ class OptimisticLockingTest < ActiveRecord::TestCase assert_equal lock_version, p1.lock_version end end + + def test_polymorphic_destroy_with_dependencies_and_lock_version + car = Car.create! + car.wheels << Wheel.create! + assert_equal 1, car.wheels.count + assert car.destroy + assert_equal 0, car.wheels.count + assert car.destroyed? + end end class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase |