add controller tests

This commit is contained in:
2026-01-23 12:20:31 +01:00
parent dea0ef508a
commit 35c29749fb
16 changed files with 515 additions and 51 deletions
+3 -3
View File
@@ -2,14 +2,14 @@ require "test_helper"
class CommentTest < ActiveSupport::TestCase
test "should be valid with a user, body, and commentable" do
user = users(:one)
user = users(:admin_user)
entry = entries(:one)
comment = Comment.new(user: user, body: "This is a comment.", commentable: entry)
assert comment.valid?
end
test "should be invalid without a body" do
user = users(:one)
user = users(:admin_user)
entry = entries(:one)
comment = Comment.new(user: user, commentable: entry)
assert_not comment.valid?
@@ -22,7 +22,7 @@ class CommentTest < ActiveSupport::TestCase
end
test "should be invalid without a commentable" do
user = users(:one)
user = users(:admin_user)
comment = Comment.new(user: user, body: "This is a comment.")
assert_not comment.valid?
end