Move implementation to own file
Prefactoring, from TDDAYMI to imperative shell. In the next step we need the implementation from the functional core in the imperative shell, to pass in the environment variable.
This commit is contained in:
@@ -1,23 +1,6 @@
|
||||
defmodule FunCore.BasicSignupWhitelistTest do
|
||||
use ExUnit.Case
|
||||
|
||||
defp normalize(email) do
|
||||
email |> String.trim() |> String.downcase()
|
||||
end
|
||||
|
||||
defp addresses_as_list(addresses_str) do
|
||||
addresses_str
|
||||
|> String.split(",")
|
||||
|> Enum.map(&normalize/1)
|
||||
end
|
||||
|
||||
def mail_whitelisted_fun(signups_allowed, email_received) do
|
||||
case signups_allowed do
|
||||
nil -> false
|
||||
"*" -> true
|
||||
list_str -> normalize(email_received) in addresses_as_list(list_str)
|
||||
end
|
||||
end
|
||||
import FunCore.BasicSignupWhitelist
|
||||
|
||||
test "addresses_as_list" do
|
||||
assert addresses_as_list("joe@example.com, jane@example.com") == [
|
||||
|
||||
Reference in New Issue
Block a user