Ensure nested attributes is restored in case of a test failure

This commit is contained in:
Carlos Antonio da Silva 2012-11-03 19:57:35 -02:00
parent 66bcaff062
commit 7c3bc58b54
1 changed files with 1 additions and 1 deletions

View File

@ -489,7 +489,7 @@ class TestNestedAttributesOnABelongsToAssociation < ActiveRecord::TestCase
@ship.update_attributes(:pirate_attributes => { :id => @ship.pirate.id, :_destroy => '1' })
assert_nothing_raised(ActiveRecord::RecordNotFound) { @ship.pirate.reload }
ensure
Ship.accepts_nested_attributes_for :pirate, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? }
end