feat: add scheduled publishing with publish_at frontmatter field
Posts with a future publish_at date are hidden from the public API and feeds, same as drafts. The admin form exposes a Publish at field.
This commit is contained in:
@@ -62,4 +62,19 @@ class PostTest < Minitest::Test
|
||||
post = Volumen::Post.new(metadata: { "slug" => "x" }, body: "short")
|
||||
assert_equal 1, post.reading_time
|
||||
end
|
||||
|
||||
def test_scheduled_post_is_not_scheduled_when_publish_at_is_past
|
||||
post = Volumen::Post.new(metadata: { "publish_at" => Date.today - 1 })
|
||||
refute_predicate post, :scheduled?
|
||||
end
|
||||
|
||||
def test_scheduled_post_is_scheduled_when_publish_at_is_future
|
||||
post = Volumen::Post.new(metadata: { "publish_at" => Date.today + 7 })
|
||||
assert_predicate post, :scheduled?
|
||||
end
|
||||
|
||||
def test_post_without_publish_at_is_not_scheduled
|
||||
post = Volumen::Post.new(metadata: {})
|
||||
refute_predicate post, :scheduled?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user