3 class DiaryCommentTest < ActiveSupport::TestCase
5 # Create the default language for diary entries
6 create(:language, :code => "en")
9 test "body must be present" do
10 comment = build(:diary_comment, :body => "")
11 assert_not comment.valid?
12 assert_not_nil comment.errors[:body], "no validation error for missing body"
15 test "body must not be too long" do
16 comment = build(:diary_comment, :body => "x" * 65536)
17 assert_predicate comment, :valid?
19 comment = build(:diary_comment, :body => "x" * 65537)
20 assert_not_predicate comment, :valid?
21 assert_not_nil comment.errors[:body], "no validation error for body too long"