Swoosh v0.14.0 Swoosh.TestAssertions View Source

This module contains a set of assertions functions that you can import in your test cases.

It is meant to be used with the Swoosh.Adapters.Test module.

Link to this section Summary

Functions

Asserts email was not sent

Asserts email was sent

Asserts no emails were sent

Link to this section Functions

Link to this function assert_email_not_sent(email) View Source

Asserts email was not sent.

Link to this function assert_email_sent(email) View Source

Asserts email was sent.

You pass a keyword list to match on specific params.

Examples

iex> alias Swoosh.Email
iex> import Swoosh.TestAssertions

iex> email = Email.new(subject: "Hello, Avengers!")
iex> Swoosh.Adapters.Test.deliver(email, [])

# assert a specific email was sent
iex> assert_email_sent email

# assert an email with specific field(s) was sent
iex> assert_email_sent subject: "Hello, Avengers!"

Asserts no emails were sent.