fake_email_validator 0.0.5 → 1.0.0

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: 20d0eb5781013735bfa67efa6983fde9db331583
4
- data.tar.gz: f0fff64c6363fb54515e87e741d382ed60eceb97
3
+ metadata.gz: ca63fcd2105a1e1f8bc6b78c54c056a719c4b853
4
+ data.tar.gz: 17a0b91cb0856467202eaf055f5f722bb4f749de
5
5
  SHA512:
6
- metadata.gz: fc18de24f0c5fe935d7888b8ef0945ccdc1ec86cf15756df961029e73bc925dba110958cf47a3b06347fee77709a8ef76b4528a6881492ea655f1f5b4e374738
7
- data.tar.gz: 2feda57e4f64187dac59f6b74168e157d55dfd143d4f9b9ad3d446547d99480bf0f242c6fc648641021906350a0d4d5268ecdaa7d56c02dce899e9f2ca7847b6
6
+ metadata.gz: 6bd7efa9885d1732242438728879f6ee3ca6b92b3a6a8534e4a931c8e01a2ccf3c18a5a598ea2f4a6838c0cba17e19d2a52d0005b6d71b0ae38f67054fd352f0
7
+ data.tar.gz: 20eec5d90e7a75bacf2ed3b04a40fdf6922467b9bca2cf315c224d086627df529937443e01538c6f8feb5d4e10be84deb82f5e3c19693a6ad076415c75d5be32
@@ -2,4 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.1
5
+ - 2.1.2
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # fake_email_validator
1
+ # fake_email_validator [![Build Status](https://travis-ci.org/maxd/fake_email_validator.png?branch=master)](https://travis-ci.org/maxd/fake_email_validator)
2
2
 
3
3
  E-Mail validator for Rails to block services like mailinator.com
4
4
 
@@ -16,6 +16,12 @@ Or install it yourself as:
16
16
 
17
17
  $ gem install fake_email_validator
18
18
 
19
+ ## How to use?
20
+
21
+ Add validator to your User model:
22
+
23
+ validates :email, fake_email: true
24
+
19
25
  ## Contributing
20
26
 
21
27
  1. Fork it ( http://github.com/maxd/fake_email_validator/fork )
@@ -3,6 +3,7 @@
3
3
  0clickemail.com
4
4
  0wnd.net
5
5
  0wnd.org
6
+ 10mail.org
6
7
  10minutemail.com
7
8
  20minutemail.com
8
9
  2prong.com
@@ -16,6 +17,7 @@
16
17
  675hosting.com
17
18
  675hosting.net
18
19
  675hosting.org
20
+ 6paq.com
19
21
  6url.com
20
22
  75hosting.com
21
23
  75hosting.net
@@ -23,11 +25,15 @@
23
25
  7tags.com
24
26
  9ox.net
25
27
  a-bc.net
28
+ abyssmail.com
29
+ acentri.com
26
30
  afrobacon.com
27
31
  ajaxapp.net
32
+ alivance.com
28
33
  amilegit.com
29
34
  amiri.net
30
35
  amiriindustries.com
36
+ anappthat.com
31
37
  anonbox.net
32
38
  anonymbox.com
33
39
  antichef.com
@@ -38,11 +44,13 @@ asdasd.ru
38
44
  azmeil.tk
39
45
  baxomale.ht.cx
40
46
  beefmilk.com
47
+ bigprofessor.so
41
48
  binkmail.com
42
49
  bio-muesli.net
43
50
  bobmail.info
44
51
  bodhi.lawlita.com
45
52
  bofthew.com
53
+ boximail.com
46
54
  brefmail.com
47
55
  broadbandninja.com
48
56
  bsnow.net
@@ -50,11 +58,13 @@ bugmenot.com
50
58
  bumpymail.com
51
59
  burstmail.info
52
60
  casualdx.com
61
+ cbair.com
53
62
  centermail.com
54
63
  centermail.net
55
64
  chammy.info
56
65
  chogmail.com
57
66
  choicemail1.com
67
+ clrmail.com
58
68
  coldemail.info
59
69
  cool.fr.nf
60
70
  correo.blogos.net
@@ -92,12 +102,14 @@ dontreg.com
92
102
  dontsendmespam.de
93
103
  drdrb.com
94
104
  drdrb.net
105
+ droplar.com
95
106
  dropmail.me
96
107
  dump-email.info
97
108
  dumpandjunk.com
98
109
  dumpmail.de
99
110
  dumpyemail.com
100
111
  e4ward.com
112
+ eelmail.com
101
113
  einrot.com
102
114
  email60.com
103
115
  emaildienst.de
@@ -143,6 +155,7 @@ fux0ringduh.com
143
155
  garliclife.com
144
156
  get1mail.com
145
157
  get2mail.fr
158
+ getairmail.com
146
159
  getonemail.com
147
160
  getonemail.net
148
161
  ghosttexter.de
@@ -157,8 +170,10 @@ gowikimusic.com
157
170
  gowikinetwork.com
158
171
  gowikitravel.com
159
172
  gowikitv.com
173
+ grandmamail.com
160
174
  great-host.in
161
175
  greensloth.com
176
+ grr.la
162
177
  gsrv.co.uk
163
178
  guerillamail.biz
164
179
  guerillamail.com
@@ -214,6 +229,7 @@ klzlk.com
214
229
  koszmail.pl
215
230
  kulturbetrieb.info
216
231
  kurzepost.de
232
+ lackmail.net
217
233
  letthemeatspam.com
218
234
  lhsdv.com
219
235
  lifebyfood.com
@@ -331,13 +347,16 @@ pjjkp.com
331
347
  politikerclub.de
332
348
  poofy.org
333
349
  pookmail.com
350
+ postalmail.biz
334
351
  privacy.net
335
352
  proxymail.eu
336
353
  prtnx.com
337
354
  punkass.com
338
355
  putthisinyourspamdatabase.com
356
+ pwrby.com
339
357
  qq.com
340
358
  quickinbox.com
359
+ rainmail.biz
341
360
  rcpt.at
342
361
  reallymymail.com
343
362
  recode.me
@@ -429,6 +448,7 @@ supergreatmail.com
429
448
  supermailer.jp
430
449
  superrito.com
431
450
  suremail.info
451
+ tafmail.com
432
452
  tagyourself.com
433
453
  teewars.org
434
454
  teleworm.com
@@ -478,6 +498,7 @@ trashymail.com
478
498
  trashymail.net
479
499
  trbvm.com
480
500
  trillianpro.com
501
+ tryalert.com
481
502
  turual.com
482
503
  twinmail.de
483
504
  tyldd.com
@@ -491,6 +512,7 @@ viditag.com
491
512
  viewcastmedia.com
492
513
  viewcastmedia.net
493
514
  viewcastmedia.org
515
+ walkmail.net
494
516
  webm4il.info
495
517
  wegwerfadresse.de
496
518
  wegwerfemail.de
@@ -521,6 +543,7 @@ yopmail.net
521
543
  ypmail.webarnak.fr.eu.org
522
544
  yuurok.com
523
545
  zehnminutenmail.de
546
+ zetmail.com
524
547
  zippymail.info
525
548
  zoaxe.com
526
549
  zoemail.org
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'fake_email_validator'
7
- spec.version = '0.0.5'
7
+ spec.version = '1.0.0'
8
8
  spec.authors = ['Maxim Dobryakov']
9
9
  spec.email = ['maxim.dobryakov@gmail.com']
10
10
  spec.summary = %q{E-Mail validator for Rails to block fake emails}
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_development_dependency 'bundler', '~> 1.5'
21
21
  spec.add_development_dependency 'rake', '~> 10'
22
- spec.add_development_dependency 'minitest', '~> 4'
22
+ spec.add_development_dependency 'minitest', '~> 5'
23
23
 
24
- spec.add_runtime_dependency 'activemodel', '~> 4.0', '> 4.0.0'
25
- spec.add_runtime_dependency 'mail', '~> 2.5', '> 2.5.3'
24
+ spec.add_runtime_dependency 'activemodel'
25
+ spec.add_runtime_dependency 'mail'
26
26
  end
@@ -16,7 +16,9 @@ class FakeEmailValidator < ActiveModel::EachValidator
16
16
  email = Mail::Address.new(value)
17
17
 
18
18
  domain = email.domain.strip.downcase
19
- is_fake = @fake_domains.include?(domain)
19
+ second_level_domain = domain.split('.')[-2..-1].join('.')
20
+
21
+ is_fake = @fake_domains.include?(domain) || @fake_domains.include?(second_level_domain)
20
22
 
21
23
  record.errors.add attribute, I18n.t(:fake, scope: I18N_SCOPE) if is_fake
22
24
  rescue Mail::Field::ParseError
@@ -1,6 +1,6 @@
1
1
  require 'minitest_helper'
2
2
 
3
- class TestFakeEmailValidator < MiniTest::Unit::TestCase
3
+ class TestFakeEmailValidator < Minitest::Test
4
4
 
5
5
  @@user_class = Class.new do
6
6
  include ActiveModel::Validations
@@ -28,10 +28,30 @@ class TestFakeEmailValidator < MiniTest::Unit::TestCase
28
28
  assert_equal 'is fake domain', @user.errors[:email].first
29
29
  end
30
30
 
31
- def test_real_email
31
+ def test_fake_email_with_third_sub_domain
32
+ @user.email = 'test@gsrv.co.uk'
33
+
34
+ assert !@user.valid?
35
+ assert_equal 'is fake domain', @user.errors[:email].first
36
+ end
37
+
38
+ def test_fake_email_with_fake_sub_domain
39
+ @user.email = 'test@a.10mail.org'
40
+
41
+ assert !@user.valid?
42
+ assert_equal 'is fake domain', @user.errors[:email].first
43
+ end
44
+
45
+ def test_real_email_1
32
46
  @user.email = 'test@gmail.com'
33
47
 
34
48
  assert @user.valid?
35
49
  end
36
50
 
51
+ def test_real_email_with_third_sub_domain
52
+ @user.email = 'test@mail.co.uk'
53
+
54
+ assert @user.valid?
55
+ end
56
+
37
57
  end
metadata CHANGED
@@ -1,97 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_email_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Dobryakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-28 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '4'
47
+ version: '5'
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: '4'
54
+ version: '5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activemodel
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '4.0'
62
- - - ">"
63
- - !ruby/object:Gem::Version
64
- version: 4.0.0
61
+ version: '0'
65
62
  type: :runtime
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '4.0'
72
- - - ">"
66
+ - - '>='
73
67
  - !ruby/object:Gem::Version
74
- version: 4.0.0
68
+ version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: mail
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
- - - "~>"
73
+ - - '>='
80
74
  - !ruby/object:Gem::Version
81
- version: '2.5'
82
- - - ">"
83
- - !ruby/object:Gem::Version
84
- version: 2.5.3
75
+ version: '0'
85
76
  type: :runtime
86
77
  prerelease: false
87
78
  version_requirements: !ruby/object:Gem::Requirement
88
79
  requirements:
89
- - - "~>"
90
- - !ruby/object:Gem::Version
91
- version: '2.5'
92
- - - ">"
80
+ - - '>='
93
81
  - !ruby/object:Gem::Version
94
- version: 2.5.3
82
+ version: '0'
95
83
  description: E-Mail validator for Rails to block services like mailinator.com
96
84
  email:
97
85
  - maxim.dobryakov@gmail.com
@@ -99,8 +87,8 @@ executables: []
99
87
  extensions: []
100
88
  extra_rdoc_files: []
101
89
  files:
102
- - ".gitignore"
103
- - ".travis.yml"
90
+ - .gitignore
91
+ - .travis.yml
104
92
  - Gemfile
105
93
  - LICENSE.txt
106
94
  - README.md
@@ -121,12 +109,12 @@ require_paths:
121
109
  - lib
122
110
  required_ruby_version: !ruby/object:Gem::Requirement
123
111
  requirements:
124
- - - ">="
112
+ - - '>='
125
113
  - !ruby/object:Gem::Version
126
114
  version: '0'
127
115
  required_rubygems_version: !ruby/object:Gem::Requirement
128
116
  requirements:
129
- - - ">="
117
+ - - '>='
130
118
  - !ruby/object:Gem::Version
131
119
  version: '0'
132
120
  requirements: []