From 04591aed9f134e65bd31a43dcfa1864fd7dea278 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Thu, 8 Sep 2016 10:01:11 +0100 Subject: [PATCH] Test DiaryComment body validation Replaces unnecessary test. --- test/models/diary_comment_test.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/models/diary_comment_test.rb b/test/models/diary_comment_test.rb index 908c79bfa..aa03dc66c 100644 --- a/test/models/diary_comment_test.rb +++ b/test/models/diary_comment_test.rb @@ -1,8 +1,9 @@ require "test_helper" class DiaryCommentTest < ActiveSupport::TestCase - def test_diary_comment_exists - comment = create(:diary_comment) - assert_includes DiaryComment.all, comment + test "body must be present" do + comment = build(:diary_comment, :body => "") + assert_not comment.valid? + assert_not_nil comment.errors[:body], "no validation error for missing body" end end -- 2.43.2