class TestAutosaveAssociationOnAHasManyAssociationWithInverse

Public Instance Methods

setup() click to toggle source
# File activerecord/test/cases/autosave_association_test.rb, line 1726
def setup
  Comment.delete_all
end
test_after_save_callback_with_autosave() click to toggle source
# File activerecord/test/cases/autosave_association_test.rb, line 1730
def test_after_save_callback_with_autosave
  post = Post.new(title: "Test", body: "...")
  comment = post.comments.build(body: "...")
  post.save!

  assert_equal 1, post.comments.count
  assert_equal 1, comment.post_comments_count
end