54 lines
1.4 KiB
Elixir
54 lines
1.4 KiB
Elixir
defmodule Blogex.Test.AlphaBlog do
|
|
@moduledoc """
|
|
A minimal blog module for cross-blog tests.
|
|
|
|
Implements the interface `Blogex.Registry` queries (and nothing else), so a
|
|
test can configure `:blogex, :blogs` with real modules without compiling a
|
|
`use Blogex.Blog` module or touching the filesystem.
|
|
|
|
`all_posts/0`/`unfiltered_posts/0` are hard-coded — the dates are literals so
|
|
tests can assert exact orderings rather than re-deriving them.
|
|
"""
|
|
|
|
alias Blogex.Test.PostBuilder
|
|
|
|
def blog_id, do: :alpha
|
|
|
|
def all_posts,
|
|
do: [PostBuilder.build(id: "a1", date: ~D[2026-03-01], blog: :alpha)]
|
|
|
|
def all_tags, do: ["elixir"]
|
|
|
|
def unfiltered_posts,
|
|
do: [
|
|
PostBuilder.build(id: "a1", date: ~D[2026-03-01], blog: :alpha),
|
|
PostBuilder.build(
|
|
id: "a-draft",
|
|
date: ~D[2026-03-05],
|
|
blog: :alpha,
|
|
published: false
|
|
)
|
|
]
|
|
end
|
|
|
|
defmodule Blogex.Test.BetaBlog do
|
|
@moduledoc """
|
|
The second blog module for cross-blog tests; see `Blogex.Test.AlphaBlog`.
|
|
"""
|
|
|
|
alias Blogex.Test.PostBuilder
|
|
|
|
def blog_id, do: :beta
|
|
|
|
def all_posts,
|
|
do: [PostBuilder.build(id: "b1", date: ~D[2026-03-15], blog: :beta)]
|
|
|
|
def all_tags, do: ["devops"]
|
|
|
|
def unfiltered_posts,
|
|
do: [
|
|
PostBuilder.build(id: "b1", date: ~D[2026-03-15], blog: :beta),
|
|
PostBuilder.build(id: "b-future", date: ~D[2099-01-01], blog: :beta)
|
|
]
|
|
end
|