Skip to content

Commit

Permalink
Fix test that tests that domain is present and don't allow domains to…
Browse files Browse the repository at this point in the history
… start with a dot, Fixes #63
  • Loading branch information
micke committed Mar 16, 2017
1 parent 9d75a6d commit c3948da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/valid_email2/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def valid?

if address.domain && address.address == @raw_address
domain = address.domain
# Valid address needs to have a dot in the domain
!!domain.match(/\./) && !domain.match(/\.{2,}/)
# Valid address needs to have a dot in the domain but not start with a dot
!!domain.match(/\./) && !domain.match(/\.{2,}/) && !domain.match(/^\./)
else
false
end
Expand Down
2 changes: 1 addition & 1 deletion spec/valid_email2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestUserDisallowBlacklisted < TestModel
end

it "should not be valid when domain is missing" do
user = TestUser.new(email: "foo")
user = TestUser.new(email: "foo@.com")
expect(user.valid?).to be_falsey
end

Expand Down

0 comments on commit c3948da

Please sign in to comment.