A factory and a basic test of validation for the issue_comment model, similar to what we have for diary_comment.
--- /dev/null
+FactoryBot.define do
+ factory :issue_comment do
+ sequence(:body) { |n| "This is issue comment #{n}" }
+
+ issue
+ user
+ end
+end
require "test_helper"
class IssueCommentTest < ActiveSupport::TestCase
require "test_helper"
class IssueCommentTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
+ test "body must be present" do
+ comment = build(:issue_comment, :body => "")
+ assert_not comment.valid?
+ assert_not_nil comment.errors[:body]
+ end