Skip to content

Instantly share code, notes, and snippets.

@itsmeurbi
Created June 28, 2022 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsmeurbi/30de5af9c03bb7171887caa7cb89492c to your computer and use it in GitHub Desktop.
Save itsmeurbi/30de5af9c03bb7171887caa7cb89492c to your computer and use it in GitHub Desktop.
require 'test_helper'
class CommentsControllerTest < ActionDispatch::IntegrationTest
test '#create stores a comment for a given post' do
my_post = Post.create(title: 'My post', content: 'My new blog post')
post post_comments_path(my_post), params: { comment: { content: 'Nice post!' } }
assert_redirected_to post_path(my_post)
assert_equal 'Comment created!', flash[:notice]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment