From: Andy Allan Date: Thu, 8 Sep 2016 09:01:11 +0000 (+0100) Subject: Test DiaryComment body validation X-Git-Tag: live~4362^2~5 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/04591aed9f134e65bd31a43dcfa1864fd7dea278 Test DiaryComment body validation Replaces unnecessary test. --- 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