]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/diary_comment_test.rb
Convert class method tests to use User factory.
[rails.git] / test / models / diary_comment_test.rb
index 908c79bfa6cc85c79e58eb37d8342a533d493024..162cfa833f2d372fac33a6217db1cf1b3a530921 100644 (file)
@@ -1,8 +1,16 @@
 require "test_helper"
 
 class DiaryCommentTest < ActiveSupport::TestCase
-  def test_diary_comment_exists
-    comment = create(:diary_comment)
-    assert_includes DiaryComment.all, comment
+  fixtures :users
+
+  def setup
+    # Create the default language for diary entries
+    create(:language, :code => "en")
+  end
+
+  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