diff options
author | Dmitry Polushkin <dmirty.polushkin@gmail.com> | 2009-07-11 18:46:11 +0200 |
---|---|---|
committer | Eloy Duran <eloy.de.enige@gmail.com> | 2009-09-12 15:56:01 +0200 |
commit | 845f62f4730fb9ab8847033f9ab7435c40006662 (patch) | |
tree | dfab1549b1df2276f35e3412e8da030342689151 /activerecord/test | |
parent | 6cc0b9638fbb6ede3c46b51d7dab17881416014c (diff) | |
download | rails-845f62f4730fb9ab8847033f9ab7435c40006662.tar.gz rails-845f62f4730fb9ab8847033f9ab7435c40006662.tar.bz2 rails-845f62f4730fb9ab8847033f9ab7435c40006662.zip |
Fix autosave association to skip validation if it is marked for destruction. [#2064 state:resolved]
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/autosave_association_test.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index fc89b83728..d51c4398d4 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -544,6 +544,7 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase assert !@pirate.valid? @pirate.ship.mark_for_destruction + @pirate.ship.expects(:valid?).never assert_difference('Ship.count', -1) { @pirate.save! } end @@ -581,6 +582,7 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase assert !@ship.valid? @ship.pirate.mark_for_destruction + @ship.pirate.expects(:valid?).never assert_difference('Pirate.count', -1) { @ship.save! } end @@ -624,7 +626,10 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase children.each { |child| child.name = '' } assert !@pirate.valid? - children.each { |child| child.mark_for_destruction } + children.each do |child| + child.mark_for_destruction + child.expects(:valid?).never + end assert_difference("#{association_name.classify}.count", -2) { @pirate.save! } end |