require "test_helper" class CommentTest < ActiveSupport::TestCase test "should be valid with a user, body, and commentable" do user = users(:admin_user) entry = entries(:one) comment = Comment.new(user: user, body: "This is a comment.", commentable: entry) assert comment.valid? end test "should be invalid without a body" do user = users(:admin_user) entry = entries(:one) comment = Comment.new(user: user, commentable: entry) assert_not comment.valid? end test "should be invalid without a user" do entry = entries(:one) comment = Comment.new(body: "This is a comment.", commentable: entry) assert_not comment.valid? end test "should be invalid without a commentable" do user = users(:admin_user) comment = Comment.new(user: user, body: "This is a comment.") assert_not comment.valid? end end