afair / email_address

The EmailAddress Gem to work with and validate email addresses.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

:host_size is Unresponsive

Levi-Green-Northpass opened this issue · comments

Not sure if anyone else has had this issue, but when I use this gem and try to set the :host_size configuration, it does not validate properly. See below:

[1] pry(main)> require 'email_address'
=> true
[2] pry(main)> EmailAddress::Config.configure(
  local_format: :standard,
  host_size: 1..4,
  host_validation: :syntax
)
=> {
...
 :host_validation=>:syntax,
 :host_size=>1..4,                     # returns correctly set configuration settings
...}
[3] pry(main)> EmailAddress.valid? "a@a.org"
=> true                                      # should be 'true' and returns 'true'
[4] pry(main)> EmailAddress.valid? "a@aaaaaaaaaaaaaa.org"
=> true                                      # should be 'false' but returns 'true'
[5] pry(main)> EmailAddress.valid? "a@aaaaaaaaaaaaaaaaaaaaaaaaaaaaa.org"
=> true                                      # should be 'false' but returns 'true'

I will also add here that :local_size and :address_size work as described in the documentation. Not sure if there is a secondary config I have to set or if this is a bug in the code, but I would appreciate some clarity on this issue. 🙂

I am using Ruby Version 2.7.4 and email_address Version 0.2.2.