defmodule Blogex.RouterTest do use ExUnit.Case import Plug.Test import Blogex.Test.PostBuilder alias Blogex.Test.FakeBlog setup do posts = [ build(id: "first-post", title: "First", tags: ["elixir"], date: ~D[2026-03-10]), build(id: "second-post", title: "Second", tags: ["otp"], date: ~D[2026-02-01]), build(id: "draft", published: false, date: ~D[2026-03-12]), build( id: "future-post", title: "Future", tags: ["elixir"], date: ~D[2099-01-01], published: true ) ] {:ok, _} = FakeBlog.start(posts, blog_id: :test, title: "Test Blog", description: "Test", base_path: "/blog/test" ) :ok end defp call(method, path) do conn(method, path) |> Blogex.Router.call(Blogex.Router.init(blog: FakeBlog)) end describe "GET /feed.xml" do test "returns RSS XML" do conn = call(:get, "/feed.xml") assert conn.status == 200 assert get_content_type(conn) =~ "application/rss+xml" assert conn.resp_body =~ " Plug.Conn.get_resp_header("content-type") |> List.first("") end end