valid_email2 1.2.9 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44f186139759bb0a218e4d8d6ba873e21fcdea8d
4
- data.tar.gz: 7c539775adb2b0c862f0a461ca800821fa573818
3
+ metadata.gz: 62bcd688e250d8f777cde7f86dd504db4a3d9d7c
4
+ data.tar.gz: 4f9b4dd2624670e9dd1c41ca961f9a3ea3f2a450
5
5
  SHA512:
6
- metadata.gz: 2c2e65fe8a09913c82e2412af71e80f6a8c18bcfb89fbb00722b2c3eccc223048bb3d2cf3928dc18eff057e0783f366051c2b0e036737e5f66db90923f8d8121
7
- data.tar.gz: 3552ed32f9e8410277abdd5cf90049b2f56126904cfb53027c65c1f14aebbf209dec3e8d63bd4851c982db152cf106a31198eb52d6efd87acac4a13b19d3cf49
6
+ metadata.gz: 8def84bad60dd1219989ab1885d0a9dbed6cd3ed0e8f3e271cabcdc4094f412e5d350b812a61f6425983d5e8d0cd83b8c50bb6edb05309d6303b00fcbc6197d5
7
+ data.tar.gz: c2742f6863b22c76f60643136c342da3414452e09e4d0164ba3fcfa3bda068dd45ec6eece46ae72bddb94b4f2ddfab0abd809678fe762e615382da35717874c8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 1.2.10
2
+ Improve performance in domain matching (https://github.com/lisinge/valid_email2/pull/62)
3
+ Add clipmail.eu (https://github.com/lisinge/valid_email2/pull/61)
4
+
1
5
  ## Version 1.2.9
2
6
  Remove example.com (https://github.com/lisinge/valid_email2/issues/59)
3
7
 
@@ -52,9 +52,10 @@ module ValidEmail2
52
52
  private
53
53
 
54
54
  def domain_is_in?(domain_list)
55
- domain_list.select { |domain|
56
- address.domain =~ (/^(.*\.)*#{domain}$/i)
57
- }.any?
55
+ address_domain = address.domain.downcase
56
+ domain_list.any? { |domain|
57
+ address_domain.end_with?(domain) && address_domain =~ /\A(?:.+\.)*?#{domain}\z/
58
+ }
58
59
  end
59
60
  end
60
61
  end
@@ -1,3 +1,3 @@
1
1
  module ValidEmail2
2
- VERSION = "1.2.9"
2
+ VERSION = "1.2.10"
3
3
  end
@@ -21,69 +21,69 @@ describe ValidEmail2 do
21
21
  subject(:user) { TestUser.new(email: "") }
22
22
 
23
23
  it "should be valid when email is empty" do
24
- user.valid?.should be_true
24
+ expect(user.valid?).to be_truthy
25
25
  end
26
26
 
27
27
  it "should not be valid when domain is missing" do
28
28
  user = TestUser.new(email: "foo")
29
- user.valid?.should be_false
29
+ expect(user.valid?).to be_falsey
30
30
  end
31
31
 
32
32
  it "should be invalid when email is malformed" do
33
33
  user = TestUser.new(email: "foo@bar")
34
- user.valid?.should be_false
34
+ expect(user.valid?).to be_falsey
35
35
  end
36
36
 
37
37
  it "should be invalid if Mail::AddressListsParser raises exception" do
38
38
  user = TestUser.new(email: "foo@gmail.com")
39
- Mail::Address.stub(:new).and_raise(Mail::Field::ParseError.new(nil, nil, nil))
40
- user.valid?.should be_false
39
+ expect(Mail::Address).to receive(:new).and_raise(Mail::Field::ParseError.new(nil, nil, nil))
40
+ expect(user.valid?).to be_falsey
41
41
  end
42
42
 
43
43
  it "shouldn't be valid if the domain constains consecutives dots" do
44
44
  user = TestUser.new(email: "foo@bar..com")
45
- user.valid?.should be_false
45
+ expect(user.valid?).to be_falsey
46
46
  end
47
47
  end
48
48
 
49
49
  describe "disposable emails" do
50
50
  it "should be valid when the domain is not in the list of disposable email providers" do
51
51
  user = TestUserDisallowDisposable.new(email: "foo@gmail.com")
52
- user.valid?.should be_true
52
+ expect(user.valid?).to be_truthy
53
53
  end
54
54
 
55
55
  it "should be invalid when domain is in the list of disposable email providers" do
56
56
  user = TestUserDisallowDisposable.new(email: "foo@#{ValidEmail2.disposable_emails.first}")
57
- user.valid?.should be_false
57
+ expect(user.valid?).to be_falsey
58
58
  end
59
59
 
60
60
  it "should be invalid when domain is a subdomain of a disposable domain" do
61
61
  user = TestUserDisallowDisposable.new(email: "foo@bar.#{ValidEmail2.disposable_emails.first}")
62
- user.valid?.should be_false
62
+ expect(user.valid?).to be_falsey
63
63
  end
64
64
  end
65
65
 
66
66
  describe "blacklisted emails" do
67
67
  it "should be valid when email is not in the blacklist" do
68
68
  user = TestUserDisallowBlacklisted.new(email: "foo@gmail.com")
69
- user.valid?.should be_true
69
+ expect(user.valid?).to be_truthy
70
70
  end
71
71
 
72
72
  it "should be invalid when email is in the blacklist" do
73
73
  user = TestUserDisallowBlacklisted.new(email: "foo@#{ValidEmail2.blacklist.first}")
74
- user.valid?.should be_false
74
+ expect(user.valid?).to be_falsey
75
75
  end
76
76
  end
77
77
 
78
78
  describe "mx lookup" do
79
79
  it "should be valid if mx records are found" do
80
80
  user = TestUserMX.new(email: "foo@gmail.com")
81
- user.valid?.should be_true
81
+ expect(user.valid?).to be_truthy
82
82
  end
83
83
 
84
84
  it "should be invalid if no mx records are found" do
85
85
  user = TestUserMX.new(email: "foo@subdomain.gmail.com")
86
- user.valid?.should be_false
86
+ expect(user.valid?).to be_falsey
87
87
  end
88
88
  end
89
89
  end
data/valid_email2.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake", "~> 11.3.0"
25
- spec.add_development_dependency "rspec", "~> 2.14.1"
25
+ spec.add_development_dependency "rspec", "~> 3.5.0"
26
26
  spec.add_runtime_dependency "mail", "~> 2.5"
27
27
  spec.add_runtime_dependency "activemodel", ">= 3.2"
28
28
  end
@@ -335,6 +335,7 @@
335
335
  - cl-cl.org
336
336
  - cl0ne.net
337
337
  - clandest.in
338
+ - clipmail.eu
338
339
  - clixser.com
339
340
  - clrmail.com
340
341
  - cmail.com
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valid_email2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micke Lisinge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-16 00:00:00.000000000 Z
11
+ date: 2017-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.14.1
47
+ version: 3.5.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.14.1
54
+ version: 3.5.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mail
57
57
  requirement: !ruby/object:Gem::Requirement