valid_email2 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/valid_email2.rb +5 -5
- data/lib/valid_email2/version.rb +1 -1
- data/spec/valid_email2_spec.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1d4fe39e4ead990b22676834dcea2a54e090d9a
|
4
|
+
data.tar.gz: 82de0c3528c6b6ea1bc10c730b6fa96f4343fbc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a538c07451106710b27fe29fc5437292be553ed73936fa819fea0bc651e14298e905627642237bf9a2058221247c8f02f5a9449ead73450b8994ddc7abec1d1f
|
7
|
+
data.tar.gz: 1252e5e86622060ad93538fd4e69db846b2bff6831f5e82f3ef9a0211429fe6fc2f36820c70671f221cfb8f8eacbbdc91c6af0149ee90db0870bdc5f073a31de
|
data/lib/valid_email2.rb
CHANGED
@@ -20,7 +20,7 @@ class EmailValidator < ActiveModel::EachValidator
|
|
20
20
|
begin
|
21
21
|
email = Mail::Address.new(value)
|
22
22
|
rescue Mail::Field::ParseError
|
23
|
-
error(record, attribute)
|
23
|
+
error(record, attribute) && return
|
24
24
|
return
|
25
25
|
end
|
26
26
|
|
@@ -29,15 +29,15 @@ class EmailValidator < ActiveModel::EachValidator
|
|
29
29
|
|
30
30
|
# Valid email needs to have a dot in the domain
|
31
31
|
unless tree.domain.dot_atom_text.elements.size > 1
|
32
|
-
error(record, attribute)
|
32
|
+
error(record, attribute) && return
|
33
33
|
end
|
34
34
|
else
|
35
|
-
error(record, attribute)
|
35
|
+
error(record, attribute) && return
|
36
36
|
end
|
37
37
|
|
38
38
|
if options[:disposable]
|
39
39
|
if self.class.disposable_emails.include?(email.domain)
|
40
|
-
error(record, attribute)
|
40
|
+
error(record, attribute) && return
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -49,7 +49,7 @@ class EmailValidator < ActiveModel::EachValidator
|
|
49
49
|
end
|
50
50
|
|
51
51
|
unless mx.any?
|
52
|
-
error(record, attribute)
|
52
|
+
error(record, attribute) && return
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/lib/valid_email2/version.rb
CHANGED
data/spec/valid_email2_spec.rb
CHANGED
@@ -30,6 +30,11 @@ describe ValidEmail2 do
|
|
30
30
|
Mail::Address.stub(:new).and_raise(Mail::Field::ParseError.new(nil, nil, nil))
|
31
31
|
user.valid?.should be_false
|
32
32
|
end
|
33
|
+
|
34
|
+
it "blah" do
|
35
|
+
user = TestUserMX.new(email: "invalid_email.com")
|
36
|
+
user.valid?.should be_false
|
37
|
+
end
|
33
38
|
end
|
34
39
|
|
35
40
|
describe "disposable emails" do
|