valid_email2 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98aa3e19a6868c3b3ac44bbbb7fed732016eda42
4
- data.tar.gz: 5993dc5dfcfb1661ce2af3a937226b061fb5f23b
3
+ metadata.gz: f1d4fe39e4ead990b22676834dcea2a54e090d9a
4
+ data.tar.gz: 82de0c3528c6b6ea1bc10c730b6fa96f4343fbc3
5
5
  SHA512:
6
- metadata.gz: cf6895efe18e256a5115cbee046476684a8084fb5df6fbbdf41d99cc3ecb65c08e5758e864daf86b3c8587accf929a706beb8dbd908cfd89f40f7c3be2914a7d
7
- data.tar.gz: 9bade03f341ba245864a1808930c0451e034c9688cd05d5700cb798098417283238ef4c074d2eaea1cd64adb6569384b660e2aa0b8ea7e47b3df318927139533
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
@@ -1,3 +1,3 @@
1
1
  module ValidEmail2
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valid_email2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micke Lisinge