typoed_email_validator: add new endings to the typo list
This commit is contained in:
Georg Gadinger 2022-10-13 08:05:44 +02:00 committed by GitHub
commit 10bd1853ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ class TypoedEmailValidator < ActiveModel::EachValidator
# this array contains "forbidden" email address endings
INVALID_ENDINGS = [
# without @:
".carrd",
".con",
".coom",
".cmo",

View File

@ -68,10 +68,12 @@ RSpec.describe User, type: :model do
# examples from the real world:
# .con is not a valid TLD
# .carrd is not a valid TLD
include_examples "invalid email", "fritz.fantom@gmail.carrd"
# neither is .con
include_examples "invalid email", "fritz.fantom@gmail.con"
include_examples "invalid email", "fritz.fantom@protonmail.con"
# neither is .coom
# nor .coom
include_examples "invalid email", "fritz.fantom@gmail.coom"
# nor .cmo
include_examples "invalid email", "gustav.geldsack@gmail.cmo"