Add some basic testing of issue_comment model

A factory and a basic test of validation for the issue_comment model, similar to what we have for diary_comment.
This commit is contained in:
Harry Wood 2022-05-06 12:38:17 +01:00
parent a4c20249b9
commit e204e1d178
2 changed files with 13 additions and 3 deletions

View file

@ -0,0 +1,8 @@
FactoryBot.define do
factory :issue_comment do
sequence(:body) { |n| "This is issue comment #{n}" }
issue
user
end
end

View file

@ -1,7 +1,9 @@
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
end