email_validator 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/email_validator.gemspec +17 -27
- data/lib/email_validator.rb +1 -1
- data/test/helper.rb +0 -1
- data/test/test_email_validator.rb +3 -3
- metadata +40 -80
- data/.gitignore +0 -21
data/README.rdoc
CHANGED
@@ -8,10 +8,10 @@ Run:
|
|
8
8
|
|
9
9
|
bundle install
|
10
10
|
|
11
|
-
|
11
|
+
Then add the following to your model:
|
12
12
|
|
13
13
|
validates :my_email_attribute, :email => true
|
14
14
|
|
15
15
|
== Credit
|
16
16
|
|
17
|
-
Based on http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3
|
17
|
+
Based on http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3
|
data/Rakefile
CHANGED
@@ -10,9 +10,8 @@ begin
|
|
10
10
|
gem.email = "balexand@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/balexand/email_validator"
|
12
12
|
gem.authors = ["Brian Alexander"]
|
13
|
-
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
13
|
gem.add_development_dependency "activerecord", ">= 0"
|
15
|
-
gem.add_development_dependency "sqlite3
|
14
|
+
gem.add_development_dependency "sqlite3", ">= 0"
|
16
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
16
|
end
|
18
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/email_validator.gemspec
CHANGED
@@ -1,61 +1,51 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{email_validator}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Alexander"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-07-23}
|
13
13
|
s.description = %q{An email validator for Rails 3. See homepage for details: http://github.com/balexand/email_validator}
|
14
14
|
s.email = %q{balexand@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
"test/test_email_validator.rb"
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"email_validator.gemspec",
|
26
|
+
"init.rb",
|
27
|
+
"lib/email_validator.rb",
|
28
|
+
"test/helper.rb",
|
29
|
+
"test/test_email_validator.rb"
|
31
30
|
]
|
32
31
|
s.homepage = %q{http://github.com/balexand/email_validator}
|
33
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
34
32
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.
|
33
|
+
s.rubygems_version = %q{1.6.2}
|
36
34
|
s.summary = %q{An email validator for Rails 3.}
|
37
|
-
s.test_files = [
|
38
|
-
"test/helper.rb",
|
39
|
-
"test/test_email_validator.rb"
|
40
|
-
]
|
41
35
|
|
42
36
|
if s.respond_to? :specification_version then
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
37
|
s.specification_version = 3
|
45
38
|
|
46
39
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
48
40
|
s.add_development_dependency(%q<activerecord>, [">= 0"])
|
49
|
-
s.add_development_dependency(%q<sqlite3
|
41
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
50
42
|
else
|
51
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
52
43
|
s.add_dependency(%q<activerecord>, [">= 0"])
|
53
|
-
s.add_dependency(%q<sqlite3
|
44
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
54
45
|
end
|
55
46
|
else
|
56
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
57
47
|
s.add_dependency(%q<activerecord>, [">= 0"])
|
58
|
-
s.add_dependency(%q<sqlite3
|
48
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
59
49
|
end
|
60
50
|
end
|
61
51
|
|
data/lib/email_validator.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
class EmailValidator < ActiveModel::EachValidator
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
5
|
-
record.errors
|
5
|
+
record.errors.add(attribute, options[:message] || "is not valid")
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
data/test/helper.rb
CHANGED
@@ -15,7 +15,7 @@ class TestEmailValidator < Test::Unit::TestCase
|
|
15
15
|
TestUser.new :email => email
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
def test_should_accept_valid_email_addresses
|
19
19
|
email_addresses = %W{
|
20
20
|
foo@bar.com f@c.com nigel.worthington@big.co.uk f@s.co s@gmail.com foo@g-mail.com -@foo.com
|
21
21
|
areallylongnameaasdfasdfasdfasdf@asdfasdfasdfasdfasdf.ab.cd.ef.gh.co.ca
|
@@ -26,7 +26,7 @@ class TestEmailValidator < Test::Unit::TestCase
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
def test_should_reject_invalid_email_addresses
|
30
30
|
email_addresses = %W{
|
31
31
|
asdfasdf f@s f@s.c foo@bar@foo.com @bar.com foo@
|
32
32
|
}
|
@@ -37,7 +37,7 @@ class TestEmailValidator < Test::Unit::TestCase
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
def test_should_properly_set_message
|
41
41
|
user = TestUser.new :email => 'invalidemail@'
|
42
42
|
assert !user.valid?
|
43
43
|
assert user.errors.full_messages.count == 1
|
metadata
CHANGED
@@ -1,77 +1,48 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_validator
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Brian Alexander
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-08-21 00:00:00 -07:00
|
12
|
+
date: 2011-07-23 00:00:00.000000000 -07:00
|
19
13
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: thoughtbot-shoulda
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
33
|
-
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
36
16
|
name: activerecord
|
37
|
-
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70106156075480 !ruby/object:Gem::Requirement
|
39
18
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
47
23
|
type: :development
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: sqlite3-ruby
|
51
24
|
prerelease: false
|
52
|
-
|
25
|
+
version_requirements: *70106156075480
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: sqlite3
|
28
|
+
requirement: &70106156074440 !ruby/object:Gem::Requirement
|
53
29
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
61
34
|
type: :development
|
62
|
-
|
63
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70106156074440
|
37
|
+
description: ! 'An email validator for Rails 3. See homepage for details: http://github.com/balexand/email_validator'
|
64
38
|
email: balexand@gmail.com
|
65
39
|
executables: []
|
66
|
-
|
67
40
|
extensions: []
|
68
|
-
|
69
|
-
extra_rdoc_files:
|
41
|
+
extra_rdoc_files:
|
70
42
|
- LICENSE
|
71
43
|
- README.rdoc
|
72
|
-
files:
|
44
|
+
files:
|
73
45
|
- .document
|
74
|
-
- .gitignore
|
75
46
|
- LICENSE
|
76
47
|
- README.rdoc
|
77
48
|
- Rakefile
|
@@ -84,37 +55,26 @@ files:
|
|
84
55
|
has_rdoc: true
|
85
56
|
homepage: http://github.com/balexand/email_validator
|
86
57
|
licenses: []
|
87
|
-
|
88
58
|
post_install_message:
|
89
|
-
rdoc_options:
|
90
|
-
|
91
|
-
require_paths:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
92
61
|
- lib
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
63
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
|
100
|
-
- 0
|
101
|
-
version: "0"
|
102
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
69
|
none: false
|
104
|
-
requirements:
|
105
|
-
- -
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
segments:
|
109
|
-
- 0
|
110
|
-
version: "0"
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
111
74
|
requirements: []
|
112
|
-
|
113
75
|
rubyforge_project:
|
114
|
-
rubygems_version: 1.
|
76
|
+
rubygems_version: 1.6.2
|
115
77
|
signing_key:
|
116
78
|
specification_version: 3
|
117
79
|
summary: An email validator for Rails 3.
|
118
|
-
test_files:
|
119
|
-
- test/helper.rb
|
120
|
-
- test/test_email_validator.rb
|
80
|
+
test_files: []
|