email_validation 1.1.1 → 1.2.0
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 +7 -0
- data/README.md +49 -0
- data/email_validation.gemspec +17 -24
- data/lib/email_validation.rb +19 -8
- metadata +45 -45
- data/.document +0 -5
- data/.rspec +0 -1
- data/Gemfile +0 -10
- data/Gemfile.lock +0 -47
- data/README.textile +0 -39
- data/Rakefile +0 -37
- data/VERSION +0 -1
- data/spec/email_validator_spec.rb +0 -30
- data/spec/spec_helper.rb +0 -10
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1a99ec260f9fa745d734f8c47bfbfefebcd89f63
|
4
|
+
data.tar.gz: 61f2e8d5180e8cb6aadc633ae0cc4174edd35599
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 94398179f18e209e96159c4f32df1c6ce7cc82702f6653b4b2b9caefbb3040a09d086822ed5e310432cb3d75c1ca8b5b8f864a2370629f6c2d24a3f2b9956af7
|
7
|
+
data.tar.gz: 0d3c21aed2a5c7ba5b20c8143353fd9f2367ef67c6a30593bf381386e0fd0d7d9513c674776e32f8d5df0367369f194cd14c2c35208d27e2ad2f701569182183
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
email_validation
|
2
|
+
================
|
3
|
+
|
4
|
+
**Simple email validator for Rails 3+**
|
5
|
+
|
6
|
+
| | |
|
7
|
+
|:------------|:--------------------------------|
|
8
|
+
| **Author** | Tim Morgan |
|
9
|
+
| **Version** | 1.1.1 (Jul 19, 2011) |
|
10
|
+
| **License** | Released under the MIT license. |
|
11
|
+
|
12
|
+
About
|
13
|
+
-----
|
14
|
+
|
15
|
+
This gem adds a very simple email address format validator to be used with
|
16
|
+
ActiveRecord models in Rails 3.0+. It supports localized error messages.
|
17
|
+
|
18
|
+
Installation
|
19
|
+
------------
|
20
|
+
|
21
|
+
Add the gem to your project's `Gemfile`:
|
22
|
+
|
23
|
+
```` ruby
|
24
|
+
gem 'email_validation'
|
25
|
+
````
|
26
|
+
|
27
|
+
Usage
|
28
|
+
-----
|
29
|
+
|
30
|
+
This gem is an `EachValidator`, and thus is used with the `validates` method:
|
31
|
+
|
32
|
+
```` ruby
|
33
|
+
class User < ActiveRecord::Base
|
34
|
+
validates :email_address,
|
35
|
+
presence: true,
|
36
|
+
email: true
|
37
|
+
end
|
38
|
+
````
|
39
|
+
|
40
|
+
The localization key is `invalid_email`, and can be specified in the localized
|
41
|
+
YAML file like so:
|
42
|
+
|
43
|
+
```` yaml
|
44
|
+
en:
|
45
|
+
activerecord:
|
46
|
+
errors:
|
47
|
+
messages:
|
48
|
+
invalid_email: Email address is invalid.
|
49
|
+
````
|
data/email_validation.gemspec
CHANGED
@@ -2,60 +2,53 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: email_validation 1.2.0 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "1.
|
8
|
+
s.name = "email_validation"
|
9
|
+
s.version = "1.2.0"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Tim Morgan"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
14
|
+
s.date = "2014-07-09"
|
15
|
+
s.description = "A simple, localizable EachValidator for email address fields in ActiveRecord 3.0."
|
16
|
+
s.email = "git@timothymorgan.info"
|
15
17
|
s.extra_rdoc_files = [
|
16
18
|
"LICENSE",
|
17
|
-
"README.
|
19
|
+
"README.md"
|
18
20
|
]
|
19
21
|
s.files = [
|
20
|
-
".document",
|
21
|
-
".rspec",
|
22
|
-
"Gemfile",
|
23
|
-
"Gemfile.lock",
|
24
22
|
"LICENSE",
|
25
|
-
"README.
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
23
|
+
"README.md",
|
28
24
|
"email_validation.gemspec",
|
29
|
-
"lib/email_validation.rb"
|
30
|
-
"spec/email_validator_spec.rb",
|
31
|
-
"spec/spec_helper.rb"
|
25
|
+
"lib/email_validation.rb"
|
32
26
|
]
|
33
|
-
s.homepage =
|
34
|
-
s.
|
35
|
-
s.
|
36
|
-
s.summary = %q{Simple email validation in Rails 3}
|
27
|
+
s.homepage = "http://github.com/riscfuture/email_validation"
|
28
|
+
s.rubygems_version = "2.3.0"
|
29
|
+
s.summary = "Simple email validation in Rails 3"
|
37
30
|
|
38
31
|
if s.respond_to? :specification_version then
|
39
|
-
s.specification_version =
|
32
|
+
s.specification_version = 4
|
40
33
|
|
41
34
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
35
|
s.add_runtime_dependency(%q<localized_each_validator>, [">= 1.0.1"])
|
43
36
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
44
37
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
45
|
-
s.add_development_dependency(%q<
|
38
|
+
s.add_development_dependency(%q<redcarpet>, [">= 0"])
|
46
39
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
47
40
|
else
|
48
41
|
s.add_dependency(%q<localized_each_validator>, [">= 1.0.1"])
|
49
42
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
50
43
|
s.add_dependency(%q<yard>, [">= 0"])
|
51
|
-
s.add_dependency(%q<
|
44
|
+
s.add_dependency(%q<redcarpet>, [">= 0"])
|
52
45
|
s.add_dependency(%q<rspec>, [">= 0"])
|
53
46
|
end
|
54
47
|
else
|
55
48
|
s.add_dependency(%q<localized_each_validator>, [">= 1.0.1"])
|
56
49
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
57
50
|
s.add_dependency(%q<yard>, [">= 0"])
|
58
|
-
s.add_dependency(%q<
|
51
|
+
s.add_dependency(%q<redcarpet>, [">= 0"])
|
59
52
|
s.add_dependency(%q<rspec>, [">= 0"])
|
60
53
|
end
|
61
54
|
end
|
data/lib/email_validation.rb
CHANGED
@@ -1,23 +1,34 @@
|
|
1
1
|
require 'localized_each_validator'
|
2
2
|
|
3
|
-
# Validates email addresses. Uses the
|
3
|
+
# Validates email addresses. Uses the `invalid_email` error message key.
|
4
4
|
#
|
5
5
|
# @example
|
6
6
|
# validates :email_address, email: true
|
7
7
|
#
|
8
|
-
#
|
8
|
+
# Options
|
9
|
+
# -------
|
9
10
|
#
|
10
|
-
# |
|
11
|
-
#
|
11
|
+
# | | |
|
12
|
+
# |:-------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
13
|
+
# | `:format` | By default, uses a simple email regex that matches most email addresses. If `:rfc_5322`, uses a full RFC 5322 email regex that will match common typos as well. If `:rfc_5322_simple`, uses a simplified version of the previous regex to ignore some common typos. |
|
14
|
+
# | `:message` | A custom message to use if the email is invalid. |
|
15
|
+
# | `:allow_nil` | If true, `nil` values are allowed. |
|
12
16
|
|
13
17
|
class EmailValidator < LocalizedEachValidator
|
14
|
-
# Regular expression describing valid emails
|
15
|
-
|
16
|
-
|
18
|
+
# Regular expression describing valid emails.
|
19
|
+
RFC5322_REGEX = /(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/i
|
20
|
+
RFC5322_SIMPLE_REGEX = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i
|
21
|
+
BASIC_REGEX = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i
|
22
|
+
|
17
23
|
error_key :invalid_email
|
18
24
|
|
19
25
|
# @private
|
20
26
|
def valid?(_, _, value)
|
21
|
-
|
27
|
+
regex = case options[:format]
|
28
|
+
when :rfc_5322 then RFC5322_REGEX
|
29
|
+
when :rfc_5322_simple then RFC5322_SIMPLE_REGEX
|
30
|
+
else BASIC_REGEX
|
31
|
+
end
|
32
|
+
value =~ /\A#{regex}\z/i || value =~ /\A.+\s+<#{regex}>\z/i
|
22
33
|
end
|
23
34
|
end
|
metadata
CHANGED
@@ -1,72 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tim Morgan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
11
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
14
12
|
dependencies:
|
15
13
|
- !ruby/object:Gem::Dependency
|
16
14
|
name: localized_each_validator
|
17
|
-
requirement:
|
18
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
19
16
|
requirements:
|
20
|
-
- -
|
17
|
+
- - '>='
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 1.0.1
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.1
|
26
27
|
- !ruby/object:Gem::Dependency
|
27
28
|
name: jeweler
|
28
|
-
requirement:
|
29
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
37
41
|
- !ruby/object:Gem::Dependency
|
38
42
|
name: yard
|
39
|
-
requirement:
|
40
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
41
44
|
requirements:
|
42
|
-
- -
|
45
|
+
- - '>='
|
43
46
|
- !ruby/object:Gem::Version
|
44
47
|
version: '0'
|
45
48
|
type: :development
|
46
49
|
prerelease: false
|
47
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
48
55
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
50
|
-
requirement:
|
51
|
-
none: false
|
56
|
+
name: redcarpet
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
52
58
|
requirements:
|
53
|
-
- -
|
59
|
+
- - '>='
|
54
60
|
- !ruby/object:Gem::Version
|
55
61
|
version: '0'
|
56
62
|
type: :development
|
57
63
|
prerelease: false
|
58
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
59
69
|
- !ruby/object:Gem::Dependency
|
60
70
|
name: rspec
|
61
|
-
requirement:
|
62
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
63
72
|
requirements:
|
64
|
-
- -
|
73
|
+
- - '>='
|
65
74
|
- !ruby/object:Gem::Version
|
66
75
|
version: '0'
|
67
76
|
type: :development
|
68
77
|
prerelease: false
|
69
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
70
83
|
description: A simple, localizable EachValidator for email address fields in ActiveRecord
|
71
84
|
3.0.
|
72
85
|
email: git@timothymorgan.info
|
@@ -74,46 +87,33 @@ executables: []
|
|
74
87
|
extensions: []
|
75
88
|
extra_rdoc_files:
|
76
89
|
- LICENSE
|
77
|
-
- README.
|
90
|
+
- README.md
|
78
91
|
files:
|
79
|
-
- .document
|
80
|
-
- .rspec
|
81
|
-
- Gemfile
|
82
|
-
- Gemfile.lock
|
83
92
|
- LICENSE
|
84
|
-
- README.
|
85
|
-
- Rakefile
|
86
|
-
- VERSION
|
93
|
+
- README.md
|
87
94
|
- email_validation.gemspec
|
88
95
|
- lib/email_validation.rb
|
89
|
-
- spec/email_validator_spec.rb
|
90
|
-
- spec/spec_helper.rb
|
91
|
-
has_rdoc: true
|
92
96
|
homepage: http://github.com/riscfuture/email_validation
|
93
97
|
licenses: []
|
98
|
+
metadata: {}
|
94
99
|
post_install_message:
|
95
100
|
rdoc_options: []
|
96
101
|
require_paths:
|
97
102
|
- lib
|
98
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
104
|
requirements:
|
101
|
-
- -
|
105
|
+
- - '>='
|
102
106
|
- !ruby/object:Gem::Version
|
103
107
|
version: '0'
|
104
|
-
segments:
|
105
|
-
- 0
|
106
|
-
hash: 3535036998513228201
|
107
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - '>='
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
|
-
rubygems_version:
|
115
|
+
rubygems_version: 2.3.0
|
116
116
|
signing_key:
|
117
|
-
specification_version:
|
117
|
+
specification_version: 4
|
118
118
|
summary: Simple email validation in Rails 3
|
119
119
|
test_files: []
|
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
-cfs
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
RedCloth (4.2.7)
|
5
|
-
activemodel (3.0.9)
|
6
|
-
activesupport (= 3.0.9)
|
7
|
-
builder (~> 2.1.2)
|
8
|
-
i18n (~> 0.5.0)
|
9
|
-
activerecord (3.0.9)
|
10
|
-
activemodel (= 3.0.9)
|
11
|
-
activesupport (= 3.0.9)
|
12
|
-
arel (~> 2.0.10)
|
13
|
-
tzinfo (~> 0.3.23)
|
14
|
-
activesupport (3.0.9)
|
15
|
-
arel (2.0.10)
|
16
|
-
builder (2.1.2)
|
17
|
-
diff-lcs (1.1.2)
|
18
|
-
git (1.2.5)
|
19
|
-
i18n (0.5.0)
|
20
|
-
jeweler (1.6.4)
|
21
|
-
bundler (~> 1.0)
|
22
|
-
git (>= 1.2.5)
|
23
|
-
rake
|
24
|
-
localized_each_validator (1.0.1)
|
25
|
-
activerecord (>= 3.0)
|
26
|
-
activesupport (>= 3.0)
|
27
|
-
rake (0.9.2)
|
28
|
-
rspec (2.6.0)
|
29
|
-
rspec-core (~> 2.6.0)
|
30
|
-
rspec-expectations (~> 2.6.0)
|
31
|
-
rspec-mocks (~> 2.6.0)
|
32
|
-
rspec-core (2.6.4)
|
33
|
-
rspec-expectations (2.6.0)
|
34
|
-
diff-lcs (~> 1.1.2)
|
35
|
-
rspec-mocks (2.6.0)
|
36
|
-
tzinfo (0.3.29)
|
37
|
-
yard (0.7.2)
|
38
|
-
|
39
|
-
PLATFORMS
|
40
|
-
ruby
|
41
|
-
|
42
|
-
DEPENDENCIES
|
43
|
-
RedCloth
|
44
|
-
jeweler
|
45
|
-
localized_each_validator (>= 1.0.1)
|
46
|
-
rspec
|
47
|
-
yard
|
data/README.textile
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
h1. email_validation -- Simple email validator for Rails 3
|
2
|
-
|
3
|
-
| *Author* | Tim Morgan |
|
4
|
-
| *Version* | 1.1.1 (Jul 19, 2011) |
|
5
|
-
| *License* | Released under the MIT license. |
|
6
|
-
|
7
|
-
h2. About
|
8
|
-
|
9
|
-
This gem adds a very simple email address format validator to be used with ActiveRecord models in Rails 3.0. It supports localized error messages.
|
10
|
-
|
11
|
-
h2. Installation
|
12
|
-
|
13
|
-
Add the gem to your project's @Gemfile@:
|
14
|
-
|
15
|
-
<pre><code>
|
16
|
-
gem 'email_validation'
|
17
|
-
</code></pre>
|
18
|
-
|
19
|
-
h2. Usage
|
20
|
-
|
21
|
-
This gem is an @EachValidator@, and thus is used with the @validates@ method:
|
22
|
-
|
23
|
-
<pre><code>
|
24
|
-
class User < ActiveRecord::Base
|
25
|
-
validates :email_address,
|
26
|
-
presence: true,
|
27
|
-
email: true
|
28
|
-
end
|
29
|
-
</code></pre>
|
30
|
-
|
31
|
-
The localization key is @invalid_email@, and can be specified in the localized YAML file like so:
|
32
|
-
|
33
|
-
<pre><code>
|
34
|
-
en:
|
35
|
-
activerecord:
|
36
|
-
errors:
|
37
|
-
messages:
|
38
|
-
invalid_email: Email address is invalid.
|
39
|
-
</code></pre>
|
data/Rakefile
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
|
12
|
-
require 'jeweler'
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
gem.name = "email_validation"
|
15
|
-
gem.summary = %Q{Simple email validation in Rails 3}
|
16
|
-
gem.description = %Q{A simple, localizable EachValidator for email address fields in ActiveRecord 3.0.}
|
17
|
-
gem.email = "git@timothymorgan.info"
|
18
|
-
gem.homepage = "http://github.com/riscfuture/email_validation"
|
19
|
-
gem.authors = [ "Tim Morgan" ]
|
20
|
-
end
|
21
|
-
Jeweler::RubygemsDotOrgTasks.new
|
22
|
-
|
23
|
-
require 'yard'
|
24
|
-
YARD::Rake::YardocTask.new('doc') do |doc|
|
25
|
-
doc.options << "-m" << "textile"
|
26
|
-
doc.options << "--protected"
|
27
|
-
doc.options << "-r" << "README.textile"
|
28
|
-
doc.options << "-o" << "doc"
|
29
|
-
doc.options << "--title" << "email_validation Documentation".inspect
|
30
|
-
|
31
|
-
doc.files = [ 'lib/*_validator.rb', 'README.textile' ]
|
32
|
-
end
|
33
|
-
|
34
|
-
require 'rspec/core/rake_task'
|
35
|
-
RSpec::Core::RakeTask.new
|
36
|
-
|
37
|
-
task(default: :spec)
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.1.1
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe EmailValidator do
|
4
|
-
before :each do
|
5
|
-
@validator = EmailValidator.new({ attributes: [ :foo, :bar ] })
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should validate an email address" do
|
9
|
-
@validator.valid?(nil, nil, 'foo@bar.com').should be_true
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should validate a name and email pair" do
|
13
|
-
@validator.valid?(nil, nil, 'Foo Bar <foo@bar.com>').should be_true
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should not validate an improper email address" do
|
17
|
-
@validator.valid?(nil, nil, 'foo@bar').should be_false
|
18
|
-
@validator.valid?(nil, nil, 'fo oo@bar.com').should be_false
|
19
|
-
@validator.valid?(nil, nil, 'foo@bar@bar.com').should be_false
|
20
|
-
@validator.valid?(nil, nil, 'foo@.com').should be_false
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should not validate an improper name and email pair" do
|
24
|
-
@validator.valid?(nil, nil, 'Foo Bar <foo@bar>').should be_false
|
25
|
-
@validator.valid?(nil, nil, 'Foo Bar <fo oo@bar.com>').should be_false
|
26
|
-
@validator.valid?(nil, nil, 'Foo Bar <foo@bar@bar.com>').should be_false
|
27
|
-
@validator.valid?(nil, nil, 'Foo Bar <foo@.com>').should be_false
|
28
|
-
@validator.valid?(nil, nil, '<foo@bar.com> Foo Bar').should be_false
|
29
|
-
end
|
30
|
-
end
|
data/spec/spec_helper.rb
DELETED