test/integration/post_delete_test.rb
def delete_post_by(user)
    log_in_as(user)

    # Assert exactly one post has been deleted.
    assert_difference 'Post.count', -1 do
      delete post_path(@post)
    end

    assert_redirected_to topic_path(@topic)
    follow_redirect!
    assert_flash_notices success: { count: 1 }
  end
# Helper method applicable to successfull post delete tests.
Helper method applicable to successfull post delete tests.
Helper method applicable to successfull post delete tests .
def delete_post_by(user)
    log_in_as(user)
    assert_difference 'Post.count', -1 do
      delete post_path(@post)
    end
    assert_redirected_to topic_path(@topic)
    follow_redirect!
    assert_flash_notices success: { count: 1 }
  end
def delete_post_by ( user ) log_in_as ( user ) assert_difference 'Post.count' , - 1 do delete post_path ( @post ) end assert_redirected_to topic_path ( @topic ) follow_redirect! assert_flash_notices success : { count : 1 } end
Helper method applicable to successfull post delete tests.
Helper method applicable to successfull post delete tests .
# Assert exactly one post has been deleted.
user