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:
parent
a4c20249b9
commit
e204e1d178
2 changed files with 13 additions and 3 deletions
8
test/factories/issue_comment.rb
Normal file
8
test/factories/issue_comment.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
FactoryBot.define do
|
||||
factory :issue_comment do
|
||||
sequence(:body) { |n| "This is issue comment #{n}" }
|
||||
|
||||
issue
|
||||
user
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue