Permalink
Browse files

test-case for #8585 => passing

  • Loading branch information...
1 parent 7596792 commit 0cc8bea6f867560ba199b166733781869b600614 @senny committed Feb 11, 2013
Showing with 11 additions and 0 deletions.
  1. +11 −0 activerecord/test/cases/autosave_association_test.rb
@@ -688,6 +688,17 @@ def test_should_save_changed_child_objects_if_parent_is_saved
assert_equal 'NewName', @parrot.reload.name
end
+ def test_mark_for_destruction_works_for_new_records
+ pirate = Pirate.new(catchphrase: "yiiihaaaa",
+ birds_attributes: [{name: "Flamingo"},
+ {name: "Owl"},
+ {name: "Penguin"}])
+
+ pirate.birds[1].mark_for_destruction
+ pirate.save!
+ assert_equal ["Flamingo", "Penguin"], pirate.birds.reload.map(&:name)
+ end
+
def test_should_destroy_has_many_as_part_of_the_save_transaction_if_they_were_marked_for_destruction
2.times { |i| @pirate.birds.create!(:name => "birds_#{i}") }

0 comments on commit 0cc8bea

Please sign in to comment.