Allow faker TLDs in testing

This commit is contained in:
Karina Kwiatek 2023-10-20 09:52:48 +02:00
parent e21f5cb39d
commit dad0d72cca

View file

@ -56,7 +56,7 @@ class TypoedEmailValidator < ActiveModel::EachValidator
# check if the TLD is valid # check if the TLD is valid
tld = domain_parts.last tld = domain_parts.last
return false unless TLDv.valid?(tld) return false unless TLDv.valid?(tld) || (Rails.env.test? && %w[example test].include?(tld))
# finally, common typos # finally, common typos
return false if INVALID_ENDINGS.any? { value.end_with?(_1) } return false if INVALID_ENDINGS.any? { value.end_with?(_1) }