Integrate whitelist in imperative shell
This commit is contained in:
@@ -6,7 +6,23 @@ defmodule BasicSignupWhitelistTest do
|
||||
System.put_env("SIGNUP_ALLOWED_EMAILS", whitelist)
|
||||
end
|
||||
|
||||
setup do
|
||||
# Save original env var
|
||||
original_env = System.get_env("SIGNUP_ALLOWED_EMAILS")
|
||||
|
||||
on_exit(fn ->
|
||||
# Restore original env var after each test
|
||||
case original_env do
|
||||
nil -> System.delete_env("SIGNUP_ALLOWED_EMAILS")
|
||||
value -> System.put_env("SIGNUP_ALLOWED_EMAILS", value)
|
||||
end
|
||||
end)
|
||||
|
||||
:ok
|
||||
end
|
||||
|
||||
test "When not set, not whitelisted" do
|
||||
System.delete_env("SIGNUP_ALLOWED_EMAILS")
|
||||
refute BasicSignupWhitelist.mail_whitelisted("joe@example.com")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user