match different casings
This commit is contained in:
parent
5aefc18098
commit
464b96b656
@ -2,7 +2,7 @@ defmodule FunCore.BasicSignupWhitelistTest do
|
||||
use ExUnit.Case
|
||||
|
||||
defp normalize(email) do
|
||||
email |> String.trim()
|
||||
email |> String.trim() |> String.downcase()
|
||||
end
|
||||
|
||||
defp addresses_as_list(addresses_str) do
|
||||
@ -15,7 +15,7 @@ defmodule FunCore.BasicSignupWhitelistTest do
|
||||
case signups_allowed do
|
||||
nil -> false
|
||||
"*" -> true
|
||||
list_str -> email_received in addresses_as_list(list_str)
|
||||
list_str -> normalize(email_received) in addresses_as_list(list_str)
|
||||
end
|
||||
end
|
||||
|
||||
@ -31,7 +31,6 @@ defmodule FunCore.BasicSignupWhitelistTest do
|
||||
assert "jane@example.com" in lst
|
||||
end
|
||||
|
||||
# test for normalize
|
||||
describe "Not whitelisted when allowed list is" do
|
||||
test "not set" do
|
||||
refute(mail_whitelisted_fun(nil, "joe@example.com"))
|
||||
@ -50,5 +49,9 @@ defmodule FunCore.BasicSignupWhitelistTest do
|
||||
test "Multiple set and one match" do
|
||||
assert(mail_whitelisted_fun("joe@example.com, jane@example.com", "jane@example.com"))
|
||||
end
|
||||
|
||||
test "Matches with different casings" do
|
||||
assert(mail_whitelisted_fun("joe@Example.com, jane@example.com", "Joe@example.com"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user