valid_email2 3.2.2 → 3.3.1
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 +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +6 -1
- data/config/disposable_email_domains.txt +25 -4
- data/lib/valid_email2.rb +28 -16
- data/lib/valid_email2/address.rb +20 -17
- data/lib/valid_email2/email_validator.rb +11 -10
- data/lib/valid_email2/version.rb +1 -1
- data/pull_mailchecker_emails.rb +1 -0
- data/spec/benchmark_spec.rb +18 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/valid_email2_spec.rb +21 -7
- data/valid_email2.gemspec +1 -0
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe834d489ba46cf4a8262cb077bf2f88b0fd866b604bf1ae628d877bbfdbb57b
|
4
|
+
data.tar.gz: af8e27efffae003ed85189ae10d1f9b6e30817e8529deb4064811156a332208e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 300c5f449125f0d6bd1abfd224aa88c65caa0377fe2b2a56ec6bc695bb3c0e9bac4ea03f2c091509c19f5cb8614137578ec8fc52a844cfd0765f9da7d5707615
|
7
|
+
data.tar.gz: ce9dfe893b11555a195f4777e3146f0065c3d49c26b289e874d01cb40da0f02f575f5a3efd8430e57bffdd2aaf52a36f05056986b789b3bd982b14d889bea0e2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
## Version 3.3.1
|
2
|
+
* Fix some performance regressions (https://github.com/micke/valid_email2/pull/150)
|
3
|
+
|
4
|
+
## Version 3.3.0
|
5
|
+
* Allow multiple addresses separated by comma (https://github.com/micke/valid_email2/pull/156)
|
6
|
+
* Make prohibited_domain_characters_regex changeable (https://github.com/micke/valid_email2/pull/157)
|
7
|
+
|
8
|
+
## Version 3.2.5
|
9
|
+
* Remove false positives
|
10
|
+
* Pull new domains
|
11
|
+
|
12
|
+
## Version 3.2.4
|
13
|
+
* Remove false positives
|
14
|
+
|
15
|
+
## Version 3.2.3
|
16
|
+
* Disallow backtick (\`) in domain
|
17
|
+
* https://github.com/micke/valid_email2/pull/152
|
18
|
+
* https://github.com/micke/valid_email2/pull/151
|
19
|
+
|
1
20
|
## Version 3.2.2
|
2
21
|
* Disallow quote (') in domain
|
3
22
|
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Validate emails with the help of the `mail` gem instead of some clunky regexp.
|
6
6
|
Aditionally validate that the domain has a MX record.
|
7
|
-
Optionally validate against a static [list of disposable email services](config/disposable_email_domains.
|
7
|
+
Optionally validate against a static [list of disposable email services](config/disposable_email_domains.txt).
|
8
8
|
Optionally validate that the email is not subaddressed ([RFC5233](https://tools.ietf.org/html/rfc5233)).
|
9
9
|
|
10
10
|
### Why?
|
@@ -83,6 +83,11 @@ To validate create your own custom message:
|
|
83
83
|
validates :email, 'valid_email_2/email': { message: "is not a valid email" }
|
84
84
|
```
|
85
85
|
|
86
|
+
To allow multiple addresses separated by comma:
|
87
|
+
```ruby
|
88
|
+
validates :email, 'valid_email_2/email': { multiple: true }
|
89
|
+
```
|
90
|
+
|
86
91
|
All together:
|
87
92
|
```ruby
|
88
93
|
validates :email, 'valid_email_2/email': { mx: true, disposable: true, disallow_subaddressing: true}
|
@@ -4181,6 +4181,9 @@ awahal0vk1o7gbyzf0.ml
|
|
4181
4181
|
awahal0vk1o7gbyzf0.tk
|
4182
4182
|
awatum.de
|
4183
4183
|
awca.eu
|
4184
|
+
awdrt.com
|
4185
|
+
awdrt.net
|
4186
|
+
awdrt.org
|
4184
4187
|
aweather.ru
|
4185
4188
|
aweightlossguide.com
|
4186
4189
|
awemail.com
|
@@ -4672,6 +4675,7 @@ beaniemania.net
|
|
4672
4675
|
beanlignt.com
|
4673
4676
|
bearegone.pro
|
4674
4677
|
bearsarefuzzy.com
|
4678
|
+
beastmail.email
|
4675
4679
|
beastrapleaks.blogspot.com
|
4676
4680
|
beatelse.com
|
4677
4681
|
beats-rock.com
|
@@ -7862,6 +7866,7 @@ cungmuachungnhom.com
|
|
7862
7866
|
cungsuyngam.com
|
7863
7867
|
cungtam.com
|
7864
7868
|
cuoiz.com
|
7869
|
+
cuoly.com
|
7865
7870
|
cuongvumarketingseo.com
|
7866
7871
|
cupf6mdhtujxytdcoxh.cf
|
7867
7872
|
cupf6mdhtujxytdcoxh.ga
|
@@ -9768,7 +9773,6 @@ edu.auction
|
|
9768
9773
|
edu.dmtc.dev
|
9769
9774
|
edu.hstu.eu.org
|
9770
9775
|
edu.my
|
9771
|
-
edu.sg
|
9772
9776
|
eduanswer.ru
|
9773
9777
|
education.eu
|
9774
9778
|
educationleaders-ksa.com
|
@@ -10118,6 +10122,7 @@ emailme.win
|
|
10118
10122
|
emailmenow.info
|
10119
10123
|
emailmiser.com
|
10120
10124
|
emailmobile.net
|
10125
|
+
emailmonkey.club
|
10121
10126
|
emailmynn.com
|
10122
10127
|
emailmysr.com
|
10123
10128
|
emailna.co
|
@@ -10347,6 +10352,7 @@ eo-z.com
|
|
10347
10352
|
eoffice.top
|
10348
10353
|
eomail.com
|
10349
10354
|
eonmech.com
|
10355
|
+
eoopy.com
|
10350
10356
|
eorbs.com
|
10351
10357
|
eos2mail.com
|
10352
10358
|
eotoplenie.ru
|
@@ -11396,6 +11402,8 @@ fitnessjockey.org
|
|
11396
11402
|
fitnessmojo.org
|
11397
11403
|
fitnessreviewsonline.com
|
11398
11404
|
fitnesszbyszko.pl
|
11405
|
+
fitschool.be
|
11406
|
+
fitschool.space
|
11399
11407
|
fittinggeeks.pl
|
11400
11408
|
fitzgeraldforjudge.com
|
11401
11409
|
five-club.com
|
@@ -12822,10 +12830,8 @@ gmmx.com
|
|
12822
12830
|
gmojl.com
|
12823
12831
|
gmsdfhail.com
|
12824
12832
|
gmssail.com
|
12825
|
-
gmx.com
|
12826
12833
|
gmx.dns-cloud.net
|
12827
12834
|
gmx.dnsabr.com
|
12828
|
-
gmx.es
|
12829
12835
|
gmx.fr.nf
|
12830
12836
|
gmx1mail.top
|
12831
12837
|
gmxip8vet5glx2n9ld.cf
|
@@ -15034,6 +15040,7 @@ inboxmail.world
|
|
15034
15040
|
inboxmails.co
|
15035
15041
|
inboxmails.net
|
15036
15042
|
inboxproxy.com
|
15043
|
+
inboxsecure.info
|
15037
15044
|
inboxstore.me
|
15038
15045
|
incarnal.pl
|
15039
15046
|
incestry.co.uk
|
@@ -15177,6 +15184,7 @@ instaindofree.com
|
|
15177
15184
|
instaku-media.com
|
15178
15185
|
instambox.com
|
15179
15186
|
instance-email.com
|
15187
|
+
instant-email.org
|
15180
15188
|
instant-job.com
|
15181
15189
|
instant-mail.de
|
15182
15190
|
instantblingmail.info
|
@@ -17263,6 +17271,7 @@ labas.com
|
|
17263
17271
|
labetteraverouge.at
|
17264
17272
|
labfortyone.tk
|
17265
17273
|
labo.ch
|
17274
|
+
labomail.pro
|
17266
17275
|
laboratortehnicadentara.ro
|
17267
17276
|
laboriously.com
|
17268
17277
|
labum.com
|
@@ -18795,6 +18804,7 @@ mailbox92.biz
|
|
18795
18804
|
mailboxheaven.info
|
18796
18805
|
mailboxint.info
|
18797
18806
|
mailboxlife.net
|
18807
|
+
mailboxok.club
|
18798
18808
|
mailboxonline.org
|
18799
18809
|
mailboxrental.org
|
18800
18810
|
mailboxxx.net
|
@@ -18984,6 +18994,7 @@ mailloading.com
|
|
18984
18994
|
maillotdefoot.com
|
18985
18995
|
mailly.xyz
|
18986
18996
|
mailman.com
|
18997
|
+
mailmanbox.com
|
18987
18998
|
mailmassa.info
|
18988
18999
|
mailmate.com
|
18989
19000
|
mailme.gq
|
@@ -19024,6 +19035,7 @@ mailnowapp.com
|
|
19024
19035
|
mailnull.com
|
19025
19036
|
mailo.cf
|
19026
19037
|
mailo.tk
|
19038
|
+
mailolo.info
|
19027
19039
|
mailonaut.com
|
19028
19040
|
mailondandan.com
|
19029
19041
|
mailone.es.vu
|
@@ -19054,6 +19066,7 @@ mailproxy.gm9.com
|
|
19054
19066
|
mailpts.com
|
19055
19067
|
mailpuppet.tk
|
19056
19068
|
mailquack.com
|
19069
|
+
mailquack.info
|
19057
19070
|
mailraccoon.com
|
19058
19071
|
mailrard01.ga
|
19059
19072
|
mailrazer.com
|
@@ -21561,6 +21574,7 @@ nomail.ga
|
|
21561
21574
|
nomail.net
|
21562
21575
|
nomail.nodns.xyz
|
21563
21576
|
nomail.pw
|
21577
|
+
nomail.top
|
21564
21578
|
nomail.xl.cx
|
21565
21579
|
nomail2me.com
|
21566
21580
|
nomailthankyou.com
|
@@ -23839,6 +23853,7 @@ privateclosets.com
|
|
23839
23853
|
privateinvest.me
|
23840
23854
|
privatemail.in
|
23841
23855
|
privatemailinator.nl
|
23856
|
+
privateme.site
|
23842
23857
|
privatemitel.cf
|
23843
23858
|
privatemitel.ml
|
23844
23859
|
privatesent.tk
|
@@ -23914,6 +23929,7 @@ prolagu.pro
|
|
23914
23929
|
prolifepowerup.com
|
23915
23930
|
promail.net
|
23916
23931
|
promail.site
|
23932
|
+
promailerapp.com
|
23917
23933
|
promails.xyz
|
23918
23934
|
promdresses-short.com
|
23919
23935
|
promenadahotel.pl
|
@@ -26757,6 +26773,7 @@ simple-mail-server.bid
|
|
26757
26773
|
simplebox.email
|
26758
26774
|
simpleemail.in
|
26759
26775
|
simpleemail.info
|
26776
|
+
simpleinboxer.site
|
26760
26777
|
simpleitsecurity.info
|
26761
26778
|
simplemail.in
|
26762
26779
|
simplemail.top
|
@@ -28469,6 +28486,7 @@ tempemailaddress.com
|
|
28469
28486
|
tempemails.io
|
28470
28487
|
tempinbox.co.uk
|
28471
28488
|
tempinbox.com
|
28489
|
+
tempinbox.xyz
|
28472
28490
|
tempm.cf
|
28473
28491
|
tempm.com
|
28474
28492
|
tempm.ga
|
@@ -29585,6 +29603,9 @@ tsukushiakihito.gq
|
|
29585
29603
|
tt2dx90.com
|
29586
29604
|
ttbbc.com
|
29587
29605
|
ttdfytdd.ml
|
29606
|
+
ttirv.com
|
29607
|
+
ttirv.net
|
29608
|
+
ttirv.org
|
29588
29609
|
ttoubdzlowecm7i2ua8.cf
|
29589
29610
|
ttoubdzlowecm7i2ua8.ga
|
29590
29611
|
ttoubdzlowecm7i2ua8.gq
|
@@ -30251,6 +30272,7 @@ url.gen.in
|
|
30251
30272
|
urleur.com
|
30252
30273
|
urltc.com
|
30253
30274
|
urlwave.org
|
30275
|
+
urmailman.com
|
30254
30276
|
urodzinydlaadzieci.pl
|
30255
30277
|
uroetueptriwe.cz.cc
|
30256
30278
|
uroid.com
|
@@ -32774,7 +32796,6 @@ yammyshop.com
|
|
32774
32796
|
yandere.cu.cc
|
32775
32797
|
yandex.ca
|
32776
32798
|
yandex.comx.cf
|
32777
|
-
yandex.net
|
32778
32799
|
yandexmail.cf
|
32779
32800
|
yandexmail.ga
|
32780
32801
|
yandexmail.gq
|
data/lib/valid_email2.rb
CHANGED
@@ -7,23 +7,35 @@ module ValidEmail2
|
|
7
7
|
WHITELIST_FILE = "config/whitelisted_email_domains.yml"
|
8
8
|
DISPOSABLE_FILE = File.expand_path('../config/disposable_email_domains.txt', __dir__)
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
class << self
|
11
|
+
def disposable_emails
|
12
|
+
@disposable_emails ||= load_file(DISPOSABLE_FILE)
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def blacklist
|
16
|
+
@blacklist ||= load_if_exists(BLACKLIST_FILE)
|
17
|
+
end
|
18
|
+
|
19
|
+
def whitelist
|
20
|
+
@whitelist ||= load_if_exists(WHITELIST_FILE)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def load_if_exists(path)
|
26
|
+
File.exist?(path) ? load_file(path) : Set.new
|
27
|
+
end
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
def load_file(path)
|
30
|
+
# This method MUST return a Set, otherwise the
|
31
|
+
# performance will suffer!
|
32
|
+
if path.end_with?(".yml")
|
33
|
+
Set.new(YAML.load_file(path))
|
34
|
+
else
|
35
|
+
File.open(path, "r").each_line.each_with_object(Set.new) do |domain, set|
|
36
|
+
set << domain.tap(&:chomp!)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
28
40
|
end
|
29
41
|
end
|
data/lib/valid_email2/address.rb
CHANGED
@@ -6,10 +6,18 @@ module ValidEmail2
|
|
6
6
|
class Address
|
7
7
|
attr_accessor :address
|
8
8
|
|
9
|
-
PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_\/\s']/
|
9
|
+
PROHIBITED_DOMAIN_CHARACTERS_REGEX = /[+!_\/\s'`]/
|
10
10
|
DEFAULT_RECIPIENT_DELIMITER = '+'.freeze
|
11
11
|
DOT_DELIMITER = '.'.freeze
|
12
12
|
|
13
|
+
def self.prohibited_domain_characters_regex
|
14
|
+
@prohibited_domain_characters_regex ||= PROHIBITED_DOMAIN_CHARACTERS_REGEX
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.prohibited_domain_characters_regex=(val)
|
18
|
+
@prohibited_domain_characters_regex = val
|
19
|
+
end
|
20
|
+
|
13
21
|
def initialize(address)
|
14
22
|
@parse_error = false
|
15
23
|
@raw_address = address
|
@@ -24,25 +32,20 @@ module ValidEmail2
|
|
24
32
|
end
|
25
33
|
|
26
34
|
def valid?
|
27
|
-
@valid
|
28
|
-
|
35
|
+
return @valid unless @valid.nil?
|
36
|
+
return false if @parse_error
|
29
37
|
|
38
|
+
@valid = begin
|
30
39
|
if address.domain && address.address == @raw_address
|
31
40
|
domain = address.domain
|
32
41
|
|
33
|
-
domain !~
|
34
|
-
|
35
|
-
domain
|
36
|
-
|
37
|
-
domain
|
38
|
-
|
39
|
-
|
40
|
-
# Domain may not start with a dash
|
41
|
-
domain !~ /^-/ &&
|
42
|
-
# Domain name may not end with a dash
|
43
|
-
domain !~ /-\./ &&
|
44
|
-
# Address may not contain a dot directly before @
|
45
|
-
address.address !~ /\.@/
|
42
|
+
domain !~ self.class.prohibited_domain_characters_regex &&
|
43
|
+
domain.include?('.') &&
|
44
|
+
!domain.include?('..') &&
|
45
|
+
!domain.start_with?('.') &&
|
46
|
+
!domain.start_with?('-') &&
|
47
|
+
!domain.include?('-.') &&
|
48
|
+
!address.local.end_with?('.')
|
46
49
|
else
|
47
50
|
false
|
48
51
|
end
|
@@ -62,7 +65,7 @@ module ValidEmail2
|
|
62
65
|
end
|
63
66
|
|
64
67
|
def disposable_domain?
|
65
|
-
|
68
|
+
domain_is_in?(ValidEmail2.disposable_emails)
|
66
69
|
end
|
67
70
|
|
68
71
|
def disposable_mx_server?
|
@@ -5,43 +5,44 @@ require "active_model/validations"
|
|
5
5
|
module ValidEmail2
|
6
6
|
class EmailValidator < ActiveModel::EachValidator
|
7
7
|
def default_options
|
8
|
-
{ regex: true, disposable: false, mx: false, disallow_subaddressing: false }
|
8
|
+
{ regex: true, disposable: false, mx: false, disallow_subaddressing: false, multiple: false }
|
9
9
|
end
|
10
10
|
|
11
11
|
def validate_each(record, attribute, value)
|
12
12
|
return unless value.present?
|
13
13
|
options = default_options.merge(self.options)
|
14
14
|
|
15
|
-
|
15
|
+
value_spitted = options[:multiple] ? value.split(',').map(&:strip) : [value]
|
16
|
+
addresses = value_spitted.map { |v| ValidEmail2::Address.new(v) }
|
16
17
|
|
17
|
-
error(record, attribute) && return unless
|
18
|
+
error(record, attribute) && return unless addresses.all?(&:valid?)
|
18
19
|
|
19
20
|
if options[:disallow_dotted]
|
20
|
-
error(record, attribute) && return if
|
21
|
+
error(record, attribute) && return if addresses.any?(&:dotted?)
|
21
22
|
end
|
22
23
|
|
23
24
|
if options[:disallow_subaddressing]
|
24
|
-
error(record, attribute) && return if
|
25
|
+
error(record, attribute) && return if addresses.any?(&:subaddressed?)
|
25
26
|
end
|
26
27
|
|
27
28
|
if options[:disposable]
|
28
|
-
error(record, attribute) && return if
|
29
|
+
error(record, attribute) && return if addresses.any?(&:disposable?)
|
29
30
|
end
|
30
31
|
|
31
32
|
if options[:disposable_domain]
|
32
|
-
error(record, attribute) && return if
|
33
|
+
error(record, attribute) && return if addresses.any?(&:disposable_domain?)
|
33
34
|
end
|
34
35
|
|
35
36
|
if options[:disposable_with_whitelist]
|
36
|
-
error(record, attribute) && return if address.disposable? && !address.whitelisted?
|
37
|
+
error(record, attribute) && return if addresses.any? { |address| address.disposable? && !address.whitelisted? }
|
37
38
|
end
|
38
39
|
|
39
40
|
if options[:blacklist]
|
40
|
-
error(record, attribute) && return if
|
41
|
+
error(record, attribute) && return if addresses.any?(&:blacklisted?)
|
41
42
|
end
|
42
43
|
|
43
44
|
if options[:mx]
|
44
|
-
error(record, attribute) && return unless
|
45
|
+
error(record, attribute) && return unless addresses.all?(&:valid_mx?)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
data/lib/valid_email2/version.rb
CHANGED
data/pull_mailchecker_emails.rb
CHANGED
@@ -8,6 +8,7 @@ require "net/http"
|
|
8
8
|
whitelisted_emails = %w(
|
9
9
|
onet.pl poczta.onet.pl fastmail.fm hushmail.com
|
10
10
|
hush.ai hush.com hushmail.me naver.com qq.com example.com
|
11
|
+
yandex.net gmx.com gmx.es
|
11
12
|
)
|
12
13
|
|
13
14
|
existing_emails = File.open("config/disposable_email_domains.txt") { |f| f.read.split("\n") }
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe "Performance testing" do
|
6
|
+
let(:disposable_domain) { ValidEmail2.disposable_emails.first }
|
7
|
+
|
8
|
+
it "has acceptable lookup performance" do
|
9
|
+
address = ValidEmail2::Address.new("test@example.com")
|
10
|
+
|
11
|
+
# preload list and check size
|
12
|
+
expect(ValidEmail2.disposable_emails).to be_a(Set)
|
13
|
+
expect(ValidEmail2.disposable_emails.count).to be > 30000
|
14
|
+
|
15
|
+
# check lookup timing
|
16
|
+
expect { address.disposable_domain? }.to perform_under(0.0001).sample(10).times
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
$:.unshift File.expand_path("../lib",__FILE__)
|
2
2
|
require "valid_email2"
|
3
3
|
|
4
|
+
# Include and configure benchmark
|
5
|
+
require 'rspec-benchmark'
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.include RSpec::Benchmark::Matchers
|
8
|
+
end
|
9
|
+
RSpec::Benchmark.configure do |config|
|
10
|
+
config.disable_gc = true
|
11
|
+
end
|
12
|
+
|
4
13
|
class TestModel
|
5
14
|
include ActiveModel::Validations
|
6
15
|
|
data/spec/valid_email2_spec.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
|
+
require "fileutils"
|
4
5
|
|
5
6
|
class TestUser < TestModel
|
6
7
|
validates :email, 'valid_email_2/email': true
|
@@ -38,6 +39,10 @@ class TestUserMessage < TestModel
|
|
38
39
|
validates :email, 'valid_email_2/email': { message: "custom message" }
|
39
40
|
end
|
40
41
|
|
42
|
+
class TestUserMultiple < TestModel
|
43
|
+
validates :email, 'valid_email_2/email': { multiple: true }
|
44
|
+
end
|
45
|
+
|
41
46
|
describe ValidEmail2 do
|
42
47
|
|
43
48
|
let(:disposable_domain) { ValidEmail2.disposable_emails.first }
|
@@ -59,7 +64,7 @@ describe ValidEmail2 do
|
|
59
64
|
expect(user.valid?).to be_falsey
|
60
65
|
end
|
61
66
|
|
62
|
-
%w[+ _ ! / \ '].each do |invalid_character|
|
67
|
+
%w[+ _ ! / \ ' `].each do |invalid_character|
|
63
68
|
it "is invalid if email contains a \"#{invalid_character}\" character" do
|
64
69
|
user = TestUser.new(email: "foo@google#{invalid_character}yahoo.com")
|
65
70
|
expect(user.valid?).to be_falsey
|
@@ -82,16 +87,11 @@ describe ValidEmail2 do
|
|
82
87
|
expect(user.valid?).to be_falsey
|
83
88
|
end
|
84
89
|
|
85
|
-
it "is invalid if the
|
90
|
+
it "is invalid if the email contains emoticons" do
|
86
91
|
user = TestUser.new(email: "foo🙈@gmail.com")
|
87
92
|
expect(user.valid?).to be_falsy
|
88
93
|
end
|
89
94
|
|
90
|
-
it "is invalid if the domain contains .@ consecutively" do
|
91
|
-
user = TestUser.new(email: "foo.@gmail.com")
|
92
|
-
expect(user.valid?).to be_falsy
|
93
|
-
end
|
94
|
-
|
95
95
|
it "is invalid if the domain contains spaces" do
|
96
96
|
user = TestUser.new(email: "user@gmail .com")
|
97
97
|
expect(user.valid?).to be_falsy
|
@@ -243,6 +243,20 @@ describe ValidEmail2 do
|
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
246
|
+
describe "with multiple addresses" do
|
247
|
+
it "tests each address for it's own" do
|
248
|
+
user = TestUserMultiple.new(email: "foo@gmail.com, bar@gmail.com")
|
249
|
+
expect(user.valid?).to be_truthy
|
250
|
+
end
|
251
|
+
|
252
|
+
context 'when one address is invalid' do
|
253
|
+
it "fails for all" do
|
254
|
+
user = TestUserMultiple.new(email: "foo@gmail.com, bar@123")
|
255
|
+
expect(user.valid?).to be_falsey
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
246
260
|
describe "#dotted?" do
|
247
261
|
it "is true when address local part contains a dot delimiter ('.')" do
|
248
262
|
email = ValidEmail2::Address.new("john.doe@gmail.com")
|
data/valid_email2.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 2.0"
|
24
24
|
spec.add_development_dependency "rake", "~> 12.3.3"
|
25
25
|
spec.add_development_dependency "rspec", "~> 3.5.0"
|
26
|
+
spec.add_development_dependency "rspec-benchmark", "~> 0.6"
|
26
27
|
spec.add_development_dependency "pry"
|
27
28
|
spec.add_runtime_dependency "mail", "~> 2.5"
|
28
29
|
spec.add_runtime_dependency "activemodel", ">= 3.2"
|
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: 3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micke Lisinge
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 3.5.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-benchmark
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.6'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: pry
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,6 +134,7 @@ files:
|
|
120
134
|
- lib/valid_email2/email_validator.rb
|
121
135
|
- lib/valid_email2/version.rb
|
122
136
|
- pull_mailchecker_emails.rb
|
137
|
+
- spec/benchmark_spec.rb
|
123
138
|
- spec/spec_helper.rb
|
124
139
|
- spec/valid_email2_spec.rb
|
125
140
|
- valid_email2.gemspec
|
@@ -127,7 +142,7 @@ homepage: https://github.com/micke/valid_email2
|
|
127
142
|
licenses:
|
128
143
|
- MIT
|
129
144
|
metadata: {}
|
130
|
-
post_install_message:
|
145
|
+
post_install_message:
|
131
146
|
rdoc_options: []
|
132
147
|
require_paths:
|
133
148
|
- lib
|
@@ -142,11 +157,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
157
|
- !ruby/object:Gem::Version
|
143
158
|
version: '0'
|
144
159
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
146
|
-
signing_key:
|
160
|
+
rubygems_version: 3.1.2
|
161
|
+
signing_key:
|
147
162
|
specification_version: 4
|
148
163
|
summary: ActiveModel validation for email. Including MX lookup and disposable email
|
149
164
|
blacklist
|
150
165
|
test_files:
|
166
|
+
- spec/benchmark_spec.rb
|
151
167
|
- spec/spec_helper.rb
|
152
168
|
- spec/valid_email2_spec.rb
|