diff options
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/locking_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 807274ca67..a8fb3548f6 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -22,7 +22,7 @@ class ReadonlyFirstNamePerson < Person end class OptimisticLockingTest < ActiveRecord::TestCase - fixtures :people, :legacy_things, :references, :string_key_objects + fixtures :people, :legacy_things, :references, :string_key_objects, :peoples_treasures def test_non_integer_lock_existing s1 = StringKeyObject.find("record1") @@ -239,6 +239,16 @@ class OptimisticLockingTest < ActiveRecord::TestCase end assert car.destroyed? end + + def test_removing_has_and_belongs_to_many_associations_upon_destroy + p = RichPerson.create! + p.treasures.create! + assert !p.treasures.empty? + p.destroy + assert p.treasures.empty? + assert RichPerson.connection.select_all("SELECT * FROM peoples_treasures WHERE rich_person_id = 1").empty? + end + end class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase |