2023-10-05 15:46:07 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "test_helper"
|
|
|
|
|
|
|
|
class BlogPostTest < ActiveSupport::TestCase
|
|
|
|
setup do
|
|
|
|
@post = blog_posts(:published)
|
|
|
|
assert @post.valid?
|
|
|
|
end
|
|
|
|
|
|
|
|
test "must have a title" do
|
|
|
|
@post.title = nil
|
|
|
|
assert_not @post.valid?
|
|
|
|
end
|
|
|
|
|
|
|
|
test "must have a user" do
|
|
|
|
@post.user = nil
|
|
|
|
assert_not @post.valid?
|
|
|
|
end
|
|
|
|
|
|
|
|
test "must have a published status" do
|
|
|
|
@post.published = nil
|
|
|
|
assert_not @post.valid?
|
|
|
|
end
|
|
|
|
|
|
|
|
test "must have a slug" do
|
|
|
|
@post.slug = nil
|
|
|
|
assert_not @post.valid?
|
|
|
|
end
|
|
|
|
|
|
|
|
test "must have content" do
|
|
|
|
@post.content = nil
|
|
|
|
assert_not @post.valid?
|
|
|
|
end
|
2023-10-06 07:26:16 +00:00
|
|
|
|
|
|
|
test "must have summary" do
|
|
|
|
@post.summary = nil
|
|
|
|
assert_not @post.valid?
|
|
|
|
end
|
2023-10-05 15:46:07 +00:00
|
|
|
end
|