Last active
July 25, 2019 17:12
-
-
Save aloukissas/1676bd72747552a98a90c68bee449720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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