# `Accrue.Test.MailerAssertions`
[🔗](https://github.com/szTheory/accrue/blob/accrue-v0.3.0/lib/accrue/test/mailer_assertions.ex#L1)

ExUnit-style assertions for `Accrue.Mailer.Test` intent captures
(D6-05). Symmetric with `Accrue.Test.PdfAssertions`.

## Usage

    use Accrue.Test.MailerAssertions
    # or
    import Accrue.Test.MailerAssertions

## Matching

- `:type` -> email intent type, also accepted as the first argument
- `:to` -> `assigns[:to] || assigns["to"]`
- `:customer_id` -> `assigns[:customer_id] || assigns["customer_id"]`
- `:assigns` -> subset match on the provided assign keys
- `:matches` -> 1-arity predicate escape hatch on `%{type:, assigns:}`

All helpers consume `{:accrue_email_delivered, type, assigns}` tuples
sent by `Accrue.Mailer.Test.deliver/2`. Messages are process-local
(no cross-test leakage), so `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.

# `assert_email_sent`
*macro* 

Asserts that an email matching `type_or_matcher` and `opts` was delivered
through `Accrue.Mailer.Test`.

# `assert_emails_sent`

Asserts exactly `expected_count` emails are delivered within the
100ms window. Flunks with the actual count on mismatch.

# `assert_no_emails_sent`

Asserts that no `:accrue_email_delivered` messages are in the mailbox.
Drains any pending message and flunks on the first one found.

# `refute_email_sent`
*macro* 

Refutes that an email matching `type_or_matcher` and `opts` was delivered
within `timeout` (default 100ms).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
