Mutare.Swoosh.Deliver (mutare_swoosh v0.2.1)

Copy Markdown View Source

:swoosh_deliver drops email delivery while keeping the success shape.

A deliver(email) / deliver(email, config) call on a configured mailer is replaced by the literal {:ok, %{}}, and deliver!/1,2 by %{} — the shapes a successful Swoosh delivery returns, with nothing sent. A piped stage (email |> Mailer.deliver()) is replaced over the whole pipe, and the email is still built. A survivor indicates that no test detected the skipped delivery. Use Swoosh.TestAssertions.assert_email_sent/1 to assert that an email was sent.

The mailer module is application-specific, so this is a configurable mutator — without the mailer: option the family produces no mutations:

[mutators: [:builtins, {Mutare.Swoosh.Deliver, mailer: MyApp.Mailer}]]

mailer: takes one module or a list (mailer: [MyApp.Mailer, MyApp.AdminMailer]); every listed mailer's mutants are reported under :swoosh_deliver. To report mailers separately, list the family twice with different mailer:/as: — Mutare's multi-instance convention. Direct, aliased, and piped calls all match. Mutare.Swoosh.all/1 configures the family while splicing the whole package in.

Each mutant is tagged with the function it replaces (deliver / deliver!) as its ignore variant, so # mutare:ignore[swoosh_deliver:deliver!] suppresses only the raising form.