Skip to content

Instantly share code, notes, and snippets.

@lasseebert
Created October 21, 2016 20:37
Show Gist options
  • Select an option

  • Save lasseebert/e8835f67614df6b51a7dcf7c0d50c4fc to your computer and use it in GitHub Desktop.

Select an option

Save lasseebert/e8835f67614df6b51a7dcf7c0d50c4fc to your computer and use it in GitHub Desktop.
defmodule MyApp.MailerTest do
use ExUnit.Case
test "it uses mock in tests" do
MyApp.Mailer.Mock.clear
MyApp.Mailer.send_test_mail("me@example.com")
assert MyApp.Mailer.Mock.mails |> length == 1
[mail] = MyApp.Mailer.Mock.mails
assert mail.to == "me@example.com"
assert mail.text == "Test from MyApp"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment