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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/valid_email2/address.rb +4 -3
- data/lib/valid_email2/version.rb +1 -1
- data/spec/valid_email2_spec.rb +13 -13
- data/valid_email2.gemspec +1 -1
- data/vendor/disposable_emails.yml +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62bcd688e250d8f777cde7f86dd504db4a3d9d7c
|
4
|
+
data.tar.gz: 4f9b4dd2624670e9dd1c41ca961f9a3ea3f2a450
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/valid_email2/address.rb
CHANGED
@@ -52,9 +52,10 @@ module ValidEmail2
|
|
52
52
|
private
|
53
53
|
|
54
54
|
def domain_is_in?(domain_list)
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
data/lib/valid_email2/version.rb
CHANGED
data/spec/valid_email2_spec.rb
CHANGED
@@ -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
|
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
|
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
|
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.
|
40
|
-
user.valid
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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", "~>
|
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
|
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.
|
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:
|
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:
|
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:
|
54
|
+
version: 3.5.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mail
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|