Swoosh.TestAssertions.assert_email_sent
You're seeing just the function
assert_email_sent
, go back to Swoosh.TestAssertions module for more information.
Specs
Asserts any email was sent.
Specs
assert_email_sent( Swoosh.Email.t() | Keyword.t() | (Swoosh.Email.t() -> boolean()) ) :: :ok | tuple() | no_return()
Asserts email
was sent.
You can pass a keyword list to match on specific params or an anonymous function that returns a boolean.
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!"
# assert an email that satisfies a condition
iex> assert_email_sent fn email -> length(email.to) == 2 end