Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Fix error in email validation #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/data_mapper/validation/rule/formats/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Formats
end
digit = '0-9'
atext = "[#{letter}#{digit}\!\#\$\%\&\'\*+\/\=\?\^\_\`\{\|\}\~\-]"
dot_atom_text = "#{atext}+([.]#{atext}*)+"
dot_atom_text = "#{atext}+([.]#{atext}+)+"
dot_atom = dot_atom_text
no_ws_ctl = '\x01-\x08\x11\x12\x14-\x1f\x7f'
qtext = "[^#{no_ws_ctl}\\x0d\\x22\\x5c]" # Non-whitespace, non-control character except for \ and "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ def valid_attributes
'Job@Book of Job',
'test@localhost',
'J. P. \'s-Gravezande, a.k.a. The [email protected]',
"[email protected]\nsomething after the newline"].each do |email|
"[email protected]\nsomething after the newline",
'[email protected]',
'[email protected]',
'mal.formed@example.',
'[email protected].',
'[email protected]'].each do |email|
describe "with email value of #{email} (non RFC2822 compliant)" do
before :all do
@model = DataMapper::Validations::Fixtures::BillOfLading.new(valid_attributes.merge(:email => email))
Expand Down