valid_email 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c4456e6c2847371b010454617b3f74f87570bbcd
4
+ data.tar.gz: d75f3182b16f5c2f7494bdb1b676a9ceab8fc861
5
+ SHA512:
6
+ metadata.gz: 055db62d9c82b22cd0f62544672e982b2d319ff5be0b95e69db6f32018d56322d35bca05d6db068c62c1d6d5edae7d3558e451c3f2e97c7911f4b03e35f4b5a6
7
+ data.tar.gz: e7f916e652702635a7730eea9dbc2fdafaf1384d8af203ada7420d76990cf106e70bc595c1f988b5e32771f63f76eac1c869ac9fcd4146bf801a499e6d9e5697
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - 2.1.1
7
+ - 2.1.2
8
+ - jruby-19mode
9
+
data/README.md CHANGED
@@ -66,6 +66,13 @@ ValidateEmail.mx_valid_with_fallback?('email@randommail.com')
66
66
  ValidateEmail.valid?('email@randommail.com')
67
67
  ```
68
68
 
69
+ Load it (and not the rails extensions) with
70
+
71
+ gem 'valid_email', require: 'valid_email/validate_email'
72
+
73
+
74
+ ### String and Nil object extensions
75
+
69
76
  There is also a String and Nil class extension, if you require the gem in this way in Gemfile:
70
77
 
71
78
  ```ruby
@@ -75,17 +82,23 @@ gem 'valid_email', require: ['valid_email/all_with_extensions']
75
82
  You will be able to use the following methods:
76
83
  ```ruby
77
84
  nil.email? # => false
78
- "jhon@gmail.com".email? # => May return true if it exists. It accepts a hash of options like ValidateEmail.valid?
85
+ "john@gmail.com".email? # => May return true if it exists. It accepts a hash of options like ValidateEmail.valid?
79
86
  ```
80
87
 
81
88
  # Credits
82
89
 
83
- * Dush dusanek[at]iquest.cz
84
90
  * Ramihajamalala Hery hery[at]rails-royce.org
85
- * Marco Perrando mperrando[at]soluzioninrete.it
91
+ * Fire-Dragon-DoL francesco.belladonna[at]gmail.com
92
+ * dush dusanek[at]iquest.cz
86
93
  * MIke Carter mike[at]mcarter.me
87
- * Oleg Shur workshur[at]gmail.com
94
+ * Heng heng[at]reamaze.com
95
+ * Marco Perrando mperrando[at]soluzioninrete.it
88
96
  * Jörg Thalheim joerg[at]higgsboson.tk
97
+ * Andrey Deryabin deriabin[at]gmail.com
98
+ * Nicholas Rutherford nick.rutherford[at]gmail.com
99
+ * Oleg Shur workshur[at]gmail.com
100
+ * Joel Chippindale joel[at]joelchippindale.com
101
+ * Sami Haahtinen sami[at]haahtinen.name
89
102
  * Jean Boussier jean.boussier[at]gmail.com
90
103
 
91
104
  # Note on Patches/Pull Requests
data/Rakefile CHANGED
@@ -7,4 +7,4 @@ RSpec::Core::RakeTask.new do |t|
7
7
  end
8
8
 
9
9
  task :default => [:spec]
10
- task :build
10
+ task :build => [:spec]
@@ -9,14 +9,13 @@ class ValidateEmail
9
9
  m = Mail::Address.new(value)
10
10
  # We must check that value contains a domain and that value is an email address
11
11
  r = m.domain && m.address == value
12
- t = m.__send__(:tree)
13
- # We need to dig into treetop
14
- # A valid domain must have dot_atom_text elements size > 1
15
- # user@localhost is excluded
16
- # treetop must respond to domain
17
- # We exclude valid email values like <user@localhost.com>
18
- # Hence we use m.__send__(tree).domain
19
- r &&= (t.domain.dot_atom_text.elements.size > 1)
12
+
13
+ # Check that domain consists of dot-atom-text elements > 1
14
+ # In mail 2.6.1, domains are invalid per rfc2822 are parsed when they shouldn't
15
+ # This is to make sure we cover those cases
16
+ domain_dot_elements = m.domain.split(/\./)
17
+ r &&= domain_dot_elements.none?(&:blank?) && domain_dot_elements.size > 1
18
+
20
19
  # Check if domain has DNS MX record
21
20
  if r && options[:mx]
22
21
  require 'valid_email/mx_validator'
@@ -1 +1 @@
1
- ValidEmailVersion = "0.0.7"
1
+ ValidEmailVersion = "0.0.8"
@@ -76,6 +76,18 @@ describe EmailValidator do
76
76
  subject.errors[:email].should == errors
77
77
  end
78
78
 
79
+ it "should fail when email domain is prefixed with dot" do
80
+ subject.email = 'john@.doe'
81
+ subject.valid?.should be_false
82
+ subject.errors[:email].should == errors
83
+ end
84
+
85
+ it "should fail when email domain contains two consecutive dots" do
86
+ subject.email = 'john@doe-two..com'
87
+ subject.valid?.should be_false
88
+ subject.errors[:email].should == errors
89
+ end
90
+
79
91
  it "should fail when email is valid with information" do
80
92
  subject.email = '"John Doe" <john@doe.com>'
81
93
  subject.valid?.should be_false
data/valid_email.gemspec CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- s.add_development_dependency "rspec"
22
+ s.add_development_dependency "rspec", "~> 2.99"
23
23
  s.add_development_dependency "rake"
24
- s.add_runtime_dependency "mail"
24
+ s.add_runtime_dependency "mail", "~> 2.6.1"
25
25
  s.add_runtime_dependency "activemodel"
26
26
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valid_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ramihajamalala Hery
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-08-02 00:00:00.000000000 Z
11
+ date: 2014-10-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '2.99'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: '2.99'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: mail
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '0'
47
+ version: 2.6.1
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: '0'
54
+ version: 2.6.1
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: activemodel
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: ActiveModel Validation for email
@@ -82,8 +73,9 @@ executables: []
82
73
  extensions: []
83
74
  extra_rdoc_files: []
84
75
  files:
85
- - .gitignore
86
- - .rvmrc
76
+ - ".gitignore"
77
+ - ".rvmrc"
78
+ - ".travis.yml"
87
79
  - Gemfile
88
80
  - LICENSE
89
81
  - README.md
@@ -110,27 +102,26 @@ files:
110
102
  - valid_email.gemspec
111
103
  homepage: http://my.rails-royce.org/2010/07/21/email-validation-in-ruby-on-rails-without-regexp
112
104
  licenses: []
105
+ metadata: {}
113
106
  post_install_message:
114
107
  rdoc_options: []
115
108
  require_paths:
116
109
  - lib
117
110
  required_ruby_version: !ruby/object:Gem::Requirement
118
- none: false
119
111
  requirements:
120
- - - ! '>='
112
+ - - ">="
121
113
  - !ruby/object:Gem::Version
122
114
  version: '0'
123
115
  required_rubygems_version: !ruby/object:Gem::Requirement
124
- none: false
125
116
  requirements:
126
- - - ! '>='
117
+ - - ">="
127
118
  - !ruby/object:Gem::Version
128
119
  version: '0'
129
120
  requirements: []
130
121
  rubyforge_project: valid_email
131
- rubygems_version: 1.8.23.2
122
+ rubygems_version: 2.2.2
132
123
  signing_key:
133
- specification_version: 3
124
+ specification_version: 4
134
125
  summary: ActiveModel Validation for email
135
126
  test_files:
136
127
  - spec/email_validator_spec.rb