Accrue.Test.PdfAssertions (accrue v0.3.0)

Copy Markdown View Source

ExUnit-style assertions for Accrue.PDF.Test render captures (D-34). Symmetric with Accrue.Test.MailerAssertions.

Usage

use Accrue.Test.PdfAssertions
# or
import Accrue.Test.PdfAssertions

Matching

  • :invoice_id -> opts[:invoice_id] || opts["invoice_id"]
  • :contains (string) -> String.contains?(html, value)
  • :matches (1-arity fn) -> predicate escape hatch on normalized render data
  • :opts_include (keyword) -> subset match on the opts keyword list

All helpers consume {:pdf_rendered, html, opts} tuples sent by Accrue.PDF.Test.render/2. Messages are process-local; async: true is safe. Cross-process owner or global capture modes are intentionally not the default; if a host test needs them, name that mode explicitly and treat it with the same caution as Mox or Swoosh global mode.

Summary

Functions

Asserts that a PDF was rendered (via Accrue.PDF.Test) matching the given matchers. Flunks if no matching message is received within timeout (default 100ms).

Refutes that a PDF render matching matchers occurred within timeout (default 100ms). Non-matching render messages are ignored.

Functions

assert_pdf_rendered(matchers \\ [], timeout \\ 100)

(macro)

Asserts that a PDF was rendered (via Accrue.PDF.Test) matching the given matchers. Flunks if no matching message is received within timeout (default 100ms).

refute_pdf_rendered(matchers \\ [], timeout \\ 100)

(macro)

Refutes that a PDF render matching matchers occurred within timeout (default 100ms). Non-matching render messages are ignored.