Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test: strict mode should accept numbers only domains #70

Merged
merged 4 commits into from
Apr 1, 2021
Merged

Conversation

delphaber
Copy link
Contributor

Hi :)

thanks for this gem!

I've noted that emails like john.doe@163.com are not considered valid in :strict mode. 163.com is a valid chinese email provider though.

I provided a failing test with this PR.

What do you think about this?

@karlwilbur
Copy link
Member

Thanks for the PR! I expect to get this review in the next 24 hours.

@delphaber
Copy link
Contributor Author

Thanks! It's just a failing PR :) I wanted to start a discussion on this, having a failing test first

@karlwilbur karlwilbur changed the base branch from master to develop April 1, 2021 14:29
@karlwilbur karlwilbur changed the base branch from develop to bugfix-72-fix-regexp-for-numeric-domains April 1, 2021 16:38
@karlwilbur karlwilbur merged commit f377c4d into K-and-R:bugfix-72-fix-regexp-for-numeric-domains Apr 1, 2021
@karlwilbur
Copy link
Member

Got expected errors running tests:

Failures:

  1) EmailValidator validation when given the valid email when in `:strict` mode 'jonh.doe@163.com' should be valid
     Failure/Error: expect(StrictUser.new(:email => email)).to be_valid
       expected `#<StrictUser:0x0000563bcacc6e68 @attributes={:email=>"jonh.doe@163.com"}, @validation_context=nil, @e...0000563bcacc6e68 ...>, @messages={:email=>["is invalid"]}, @details={:email=>[{:error=>:invalid}]}>>.valid?` to be truthy, got false
     # ./spec/email_validator_spec.rb:172:in `block (6 levels) in <top (required)>'

  2) EmailValidator validation when given the valid email when in `:strict` mode 'jonh.doe@163.com' should be valid using EmailValidator.valid?
     Failure/Error: expect(described_class).to be_valid(email, :mode => :strict)
       expected `EmailValidator.valid?("jonh.doe@163.com", {:mode=>:strict})` to be truthy, got false
     # ./spec/email_validator_spec.rb:176:in `block (6 levels) in <top (required)>'

  3) EmailValidator validation when given the valid email when in `:strict` mode 'jonh.doe@163.com' should not be invalid using EmailValidator.valid?
     Failure/Error: expect(described_class).not_to be_invalid(email, :mode => :strict)
       expected `EmailValidator.invalid?("jonh.doe@163.com", {:mode=>:strict})` to be falsey, got true
     # ./spec/email_validator_spec.rb:180:in `block (6 levels) in <top (required)>'

  4) EmailValidator validation when given the valid email when in `:strict` mode 'jonh.doe@163.com' should match the regexp
     Failure/Error: expect(!!(email.strip =~ described_class.regexp(:mode => :strict))).to be(true)
     
       expected true
            got false
     # ./spec/email_validator_spec.rb:184:in `block (6 levels) in <top (required)>'

Finished in 3.33 seconds (files took 5.41 seconds to load)
4148 examples, 4 failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants