Follow Elixir naming conventions by using question mark suffix for boolean functions. Renamed mail_allowlisted to signup_allowed? and mail_allowlisted_fun to signup_allowed_fun throughout the codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
864 B
Elixir
30 lines
864 B
Elixir
defmodule BasicSignupAllowlistTest do
|
|
use ExUnit.Case, async: false
|
|
doctest BasicSignupAllowlist
|
|
|
|
defp allow_signups_for(allowlist) do
|
|
System.put_env(BasicSignupAllowlist.signup_allowlist_emails(), allowlist)
|
|
end
|
|
|
|
describe "setup in describe block" do
|
|
setup do
|
|
on_exit(fn ->
|
|
# resetting values did not work, so 'just' set it to the effect without this module configured.
|
|
System.put_env(BasicSignupAllowlist.signup_allowlist_emails(), "*")
|
|
end)
|
|
|
|
:ok
|
|
end
|
|
|
|
test "When not set, not allowlisted" do
|
|
System.delete_env(BasicSignupAllowlist.signup_allowlist_emails())
|
|
refute BasicSignupAllowlist.signup_allowed?("joe@example.com")
|
|
end
|
|
|
|
test "When set to star, allowlisted" do
|
|
allow_signups_for("*")
|
|
assert BasicSignupAllowlist.signup_allowed?("joe@example.com")
|
|
end
|
|
end
|
|
end
|