feat: add JSON Feed endpoint at /api/volumen/feed.json

Implements jsonfeed.org version 1.1 with title, home_page_url, feed_url,
description, language, and items with content_html and date_published.
This commit is contained in:
2026-06-25 22:06:49 +02:00
parent 73be893bf8
commit 599c63e5bc
3 changed files with 51 additions and 0 deletions
+12
View File
@@ -141,4 +141,16 @@ class ServerTest < Minitest::Test
slugs = JSON.parse(last_response.body)["posts"].map { |post| post["slug"] }
refute_includes slugs, "later"
end
def test_json_feed_endpoint
get "/api/volumen/feed.json"
assert_predicate last_response, :ok?
data = JSON.parse(last_response.body)
assert_equal "https://jsonfeed.org/version/1.1", data["version"]
assert_equal "My Blog", data["title"]
assert_equal 1, data["items"].length
assert_equal "Hello", data["items"].first["title"]
assert_includes data["items"].first["content_html"], "<strong>world</strong>"
refute_includes data["items"].map { |i| i["title"] }, "Draft"
end
end