Skip to content

Instantly share code, notes, and snippets.

@aloukissas
Last active July 25, 2019 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aloukissas/1676bd72747552a98a90c68bee449720 to your computer and use it in GitHub Desktop.
Save aloukissas/1676bd72747552a98a90c68bee449720 to your computer and use it in GitHub Desktop.
defmodule Acme.EmailTest do
use ExUnit.Case
alias Acme.Models.User
test "welcome email" do
user = %User{first_name: "John", email: "person@example.com"}
email = Acme.Email.welcome_user(user)
assert email.to == user
assert email.subject == "Welcome to Acme Products"
end
test "welcome email for active user" do
user = %User{first_name: "John", email: "person@example.com", state: "ACTIVE"}
email = Acme.Email.welcome_user(user)
assert email.to == user
assert email.subject == "Welcome to Acme Products"
end
test "welcome email for inactive user raises" do
user = %User{first_name: "John", email: "person@example.com", state: "INACTIVE"}
assert_raise FunctionClauseError, fn -> Acme.Email.welcome_user(user) end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment