rails_email_validator 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -2
- data/README.rdoc +6 -1
- data/Rakefile +10 -29
- data/VERSION +1 -1
- data/rails_email_validator.gemspec +20 -18
- data/spec/rails_email_validator_spec.rb +144 -0
- data/spec/spec_helper.rb +14 -0
- metadata +28 -43
- data/test/helper.rb +0 -20
- data/test/test_rails_email_validator.rb +0 -126
data/Gemfile
CHANGED
@@ -7,7 +7,9 @@ source "http://rubygems.org"
|
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
group :development do
|
9
9
|
gem "bundler", "~> 1.0.0"
|
10
|
-
gem "jeweler", "~> 1.5.
|
11
|
-
gem
|
10
|
+
gem "jeweler", "~> 1.5.2"
|
11
|
+
gem 'simplecov', '>= 0.3.8', :require => false
|
12
12
|
gem "idn", :git => "git://github.com/mihu/idn.git"
|
13
|
+
gem "rspec", "~> 2.3.0"
|
14
|
+
gem "yard", "~> 0.6.0"
|
13
15
|
end
|
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@ Add the following line to your Gemfile
|
|
5
5
|
gem "rails_email_validator"
|
6
6
|
|
7
7
|
If you want to use it as plugin
|
8
|
-
rails plugin install git://github.com/
|
8
|
+
rails plugin install git://github.com/phatworx/rails_email_validator.git
|
9
9
|
|
10
10
|
== Using
|
11
11
|
Use to validate email
|
@@ -32,6 +32,11 @@ If you want to support idn for email, you must install idn.
|
|
32
32
|
fork with ruby 1.9 support
|
33
33
|
gem "idn", :git => "git://github.com/mihu/idn.git"
|
34
34
|
|
35
|
+
== Maintainers
|
36
|
+
|
37
|
+
* Team Phatworx (http://github.com/phatworx)
|
38
|
+
* Marco Scholl (http://github.com/traxanos)
|
39
|
+
|
35
40
|
== Contributing to rails_email_validator
|
36
41
|
|
37
42
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ require 'jeweler'
|
|
13
13
|
Jeweler::Tasks.new do |gem|
|
14
14
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
15
|
gem.name = "rails_email_validator"
|
16
|
-
gem.homepage = "http://github.com/
|
16
|
+
gem.homepage = "http://github.com/phatworx/rails_email_validator"
|
17
17
|
gem.license = "MIT"
|
18
18
|
gem.summary = %Q{an email validator for rails}
|
19
19
|
gem.description = %Q{a class to validate emails. it builded for rails}
|
@@ -21,37 +21,18 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.authors = ["Marco Scholl"]
|
22
22
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
23
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
-
gem.add_runtime_dependency 'activemodel', '>= 3.0.0'
|
25
|
-
#
|
24
|
+
# gem.add_runtime_dependency 'activemodel', '>= 3.0.0'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
26
|
end
|
27
27
|
Jeweler::RubygemsDotOrgTasks.new
|
28
28
|
|
29
|
-
require '
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
test.verbose = true
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
34
33
|
end
|
35
34
|
|
36
|
-
|
37
|
-
task :report do
|
38
|
-
require 'cover_me'
|
39
|
-
CoverMe.complete!
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
task :test do
|
44
|
-
Rake::Task['cover_me:report'].invoke
|
45
|
-
end
|
35
|
+
task :default => :spec
|
46
36
|
|
47
|
-
|
48
|
-
|
49
|
-
require 'rake/rdoctask'
|
50
|
-
Rake::RDocTask.new do |rdoc|
|
51
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
52
|
-
|
53
|
-
rdoc.rdoc_dir = 'rdoc'
|
54
|
-
rdoc.title = "rails_email_validator #{version}"
|
55
|
-
rdoc.rdoc_files.include('README*')
|
56
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
57
|
-
end
|
37
|
+
require 'yard'
|
38
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rails_email_validator}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marco Scholl"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-02-13}
|
13
13
|
s.description = %q{a class to validate emails. it builded for rails}
|
14
14
|
s.email = %q{develop@marco-scholl.de}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,45 +26,47 @@ Gem::Specification.new do |s|
|
|
26
26
|
"init.rb",
|
27
27
|
"lib/rails_email_validator.rb",
|
28
28
|
"rails_email_validator.gemspec",
|
29
|
-
"
|
30
|
-
"
|
29
|
+
"spec/rails_email_validator_spec.rb",
|
30
|
+
"spec/spec_helper.rb"
|
31
31
|
]
|
32
|
-
s.homepage = %q{http://github.com/
|
32
|
+
s.homepage = %q{http://github.com/phatworx/rails_email_validator}
|
33
33
|
s.licenses = ["MIT"]
|
34
34
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.
|
35
|
+
s.rubygems_version = %q{1.5.0}
|
36
36
|
s.summary = %q{an email validator for rails}
|
37
37
|
s.test_files = [
|
38
|
-
"
|
39
|
-
"
|
38
|
+
"spec/rails_email_validator_spec.rb",
|
39
|
+
"spec/spec_helper.rb"
|
40
40
|
]
|
41
41
|
|
42
42
|
if s.respond_to? :specification_version then
|
43
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
43
|
s.specification_version = 3
|
45
44
|
|
46
45
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
46
|
s.add_runtime_dependency(%q<activemodel>, [">= 3.0.0"])
|
48
47
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.
|
50
|
-
s.add_development_dependency(%q<
|
48
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
49
|
+
s.add_development_dependency(%q<simplecov>, [">= 0.3.8"])
|
51
50
|
s.add_development_dependency(%q<idn>, [">= 0"])
|
52
|
-
s.
|
51
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
52
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
53
53
|
else
|
54
54
|
s.add_dependency(%q<activemodel>, [">= 3.0.0"])
|
55
55
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
56
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.
|
57
|
-
s.add_dependency(%q<
|
56
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
57
|
+
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
58
58
|
s.add_dependency(%q<idn>, [">= 0"])
|
59
|
-
s.add_dependency(%q<
|
59
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
60
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
60
61
|
end
|
61
62
|
else
|
62
63
|
s.add_dependency(%q<activemodel>, [">= 3.0.0"])
|
63
64
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
64
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.
|
65
|
-
s.add_dependency(%q<
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
66
|
+
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
66
67
|
s.add_dependency(%q<idn>, [">= 0"])
|
67
|
-
s.add_dependency(%q<
|
68
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
69
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
@@ -0,0 +1,144 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
|
+
|
4
|
+
describe EmailValidator do
|
5
|
+
before do
|
6
|
+
class ValidateEmail
|
7
|
+
include ActiveModel::Validations
|
8
|
+
attr_accessor :email
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "default email validation" do
|
13
|
+
|
14
|
+
before do
|
15
|
+
class ValidateDefaultEmail < ValidateEmail
|
16
|
+
validates :email, :email => true
|
17
|
+
end
|
18
|
+
@object = ValidateDefaultEmail.new
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "email validation with valid mx host" do
|
22
|
+
|
23
|
+
it "should validate without errors" do
|
24
|
+
[
|
25
|
+
'test@marco-scholl.de'
|
26
|
+
].each do |email|
|
27
|
+
|
28
|
+
@object.email = email
|
29
|
+
@object.should be_valid
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "email validation with invalid mx host" do
|
37
|
+
it "should validate with errors" do
|
38
|
+
[
|
39
|
+
'test@invalidmx.marco-scholl.de'
|
40
|
+
].each do |email|
|
41
|
+
|
42
|
+
@object.email = email
|
43
|
+
@object.should_not be_valid
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "email vaildation with disabled mx check" do
|
51
|
+
before do
|
52
|
+
class ValidateEmailWithoutMx < ValidateEmail
|
53
|
+
validates :email, :email => {:validate_mx => false}
|
54
|
+
end
|
55
|
+
@object = ValidateEmailWithoutMx.new
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "valid email validation" do
|
59
|
+
|
60
|
+
it "should validate without errors" do
|
61
|
+
[
|
62
|
+
nil,
|
63
|
+
'',
|
64
|
+
' ',
|
65
|
+
'test@example.net',
|
66
|
+
'test@sub1.example.net',
|
67
|
+
'test@sub1.example.co.uk',
|
68
|
+
'test@sub2.sub1.example.net',
|
69
|
+
'test@sub2.sub1.example.tttttttt',
|
70
|
+
'test@mexample.net.'
|
71
|
+
].each do |email|
|
72
|
+
|
73
|
+
@object.email = email
|
74
|
+
@object.should be_valid
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "invalid email validation" do
|
82
|
+
it "should validate with errors" do
|
83
|
+
|
84
|
+
[
|
85
|
+
1.2,
|
86
|
+
1,
|
87
|
+
'email',
|
88
|
+
'test@localhost',
|
89
|
+
'müller@example.net',
|
90
|
+
'test@example.net..'
|
91
|
+
].each do |email|
|
92
|
+
|
93
|
+
@object.email = email
|
94
|
+
@object.should_not be_valid
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe "valid email validation with idn domains" do
|
101
|
+
it "should validate without errors" do
|
102
|
+
[
|
103
|
+
'mueller@müller.de',
|
104
|
+
'test@räksmörgås.nu',
|
105
|
+
'test@sub1.räksmörgås.nu',
|
106
|
+
'test@xn--rksmrgs-5wao1o.nu',
|
107
|
+
'test@sub1.xn--rksmrgs-5wao1o.nu'
|
108
|
+
].each do |email|
|
109
|
+
|
110
|
+
@object.email = email
|
111
|
+
@object.should be_valid
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
describe "email vaildation with disabled idn support" do
|
119
|
+
before do
|
120
|
+
class ValidateEmailDisabledIdm < ValidateEmail
|
121
|
+
validates :email, :email => {:allow_idn => false}
|
122
|
+
end
|
123
|
+
@object = ValidateEmailDisabledIdm.new
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "valid email with idn domain" do
|
127
|
+
it "should validate with errors" do
|
128
|
+
[
|
129
|
+
'mueller@müller.de',
|
130
|
+
'test@räksmörgås.nu',
|
131
|
+
'test@sub1.räksmörgås.nu',
|
132
|
+
'test@xn--rksmrgs-5wao1o.nu',
|
133
|
+
'test@sub1.xn--rksmrgs-5wao1o.nu'
|
134
|
+
].each do |email|
|
135
|
+
|
136
|
+
@object.email = email
|
137
|
+
@object.should_not be_valid
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start 'rails'
|
5
|
+
require 'rspec'
|
6
|
+
require 'rails_email_validator'
|
7
|
+
|
8
|
+
# Requires supporting files with custom matchers and macros, etc,
|
9
|
+
# in ./support/ and its subdirectories.
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
|
14
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_email_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
version: 0.1.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.2
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Marco Scholl
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-02-13 00:00:00 +01:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -24,10 +20,6 @@ dependencies:
|
|
24
20
|
requirements:
|
25
21
|
- - ">="
|
26
22
|
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 3
|
29
|
-
- 0
|
30
|
-
- 0
|
31
23
|
version: 3.0.0
|
32
24
|
type: :runtime
|
33
25
|
prerelease: false
|
@@ -39,10 +31,6 @@ dependencies:
|
|
39
31
|
requirements:
|
40
32
|
- - ~>
|
41
33
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 1
|
44
|
-
- 0
|
45
|
-
- 0
|
46
34
|
version: 1.0.0
|
47
35
|
type: :development
|
48
36
|
prerelease: false
|
@@ -54,24 +42,18 @@ dependencies:
|
|
54
42
|
requirements:
|
55
43
|
- - ~>
|
56
44
|
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
- 1
|
59
|
-
- 5
|
60
|
-
- 1
|
61
|
-
version: 1.5.1
|
45
|
+
version: 1.5.2
|
62
46
|
type: :development
|
63
47
|
prerelease: false
|
64
48
|
version_requirements: *id003
|
65
49
|
- !ruby/object:Gem::Dependency
|
66
|
-
name:
|
50
|
+
name: simplecov
|
67
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
52
|
none: false
|
69
53
|
requirements:
|
70
54
|
- - ">="
|
71
55
|
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
- 0
|
74
|
-
version: "0"
|
56
|
+
version: 0.3.8
|
75
57
|
type: :development
|
76
58
|
prerelease: false
|
77
59
|
version_requirements: *id004
|
@@ -82,27 +64,32 @@ dependencies:
|
|
82
64
|
requirements:
|
83
65
|
- - ">="
|
84
66
|
- !ruby/object:Gem::Version
|
85
|
-
segments:
|
86
|
-
- 0
|
87
67
|
version: "0"
|
88
68
|
type: :development
|
89
69
|
prerelease: false
|
90
70
|
version_requirements: *id005
|
91
71
|
- !ruby/object:Gem::Dependency
|
92
|
-
name:
|
72
|
+
name: rspec
|
93
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
94
74
|
none: false
|
95
75
|
requirements:
|
96
|
-
- -
|
76
|
+
- - ~>
|
97
77
|
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
|
100
|
-
- 0
|
101
|
-
- 0
|
102
|
-
version: 3.0.0
|
103
|
-
type: :runtime
|
78
|
+
version: 2.3.0
|
79
|
+
type: :development
|
104
80
|
prerelease: false
|
105
81
|
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: yard
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.6.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id007
|
106
93
|
description: a class to validate emails. it builded for rails
|
107
94
|
email: develop@marco-scholl.de
|
108
95
|
executables: []
|
@@ -122,10 +109,10 @@ files:
|
|
122
109
|
- init.rb
|
123
110
|
- lib/rails_email_validator.rb
|
124
111
|
- rails_email_validator.gemspec
|
125
|
-
-
|
126
|
-
-
|
112
|
+
- spec/rails_email_validator_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
127
114
|
has_rdoc: true
|
128
|
-
homepage: http://github.com/
|
115
|
+
homepage: http://github.com/phatworx/rails_email_validator
|
129
116
|
licenses:
|
130
117
|
- MIT
|
131
118
|
post_install_message:
|
@@ -138,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
125
|
requirements:
|
139
126
|
- - ">="
|
140
127
|
- !ruby/object:Gem::Version
|
141
|
-
hash: -
|
128
|
+
hash: -2873198285115179955
|
142
129
|
segments:
|
143
130
|
- 0
|
144
131
|
version: "0"
|
@@ -147,16 +134,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
134
|
requirements:
|
148
135
|
- - ">="
|
149
136
|
- !ruby/object:Gem::Version
|
150
|
-
segments:
|
151
|
-
- 0
|
152
137
|
version: "0"
|
153
138
|
requirements: []
|
154
139
|
|
155
140
|
rubyforge_project:
|
156
|
-
rubygems_version: 1.
|
141
|
+
rubygems_version: 1.5.0
|
157
142
|
signing_key:
|
158
143
|
specification_version: 3
|
159
144
|
summary: an email validator for rails
|
160
145
|
test_files:
|
161
|
-
-
|
162
|
-
-
|
146
|
+
- spec/rails_email_validator_spec.rb
|
147
|
+
- spec/spec_helper.rb
|
data/test/helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
begin
|
6
|
-
Bundler.setup(:default, :development)
|
7
|
-
rescue Bundler::BundlerError => e
|
8
|
-
$stderr.puts e.message
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
11
|
-
end
|
12
|
-
require 'cover_me'
|
13
|
-
require 'test/unit'
|
14
|
-
|
15
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
16
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
17
|
-
require 'rails_email_validator'
|
18
|
-
|
19
|
-
class Test::Unit::TestCase
|
20
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'helper'
|
4
|
-
|
5
|
-
class ValidateEmailWithMx
|
6
|
-
include ActiveModel::Validations
|
7
|
-
attr_accessor :email
|
8
|
-
validates :email, :email => true
|
9
|
-
end
|
10
|
-
|
11
|
-
class ValidateEmailWithoutMx
|
12
|
-
include ActiveModel::Validations
|
13
|
-
attr_accessor :email
|
14
|
-
validates :email, :email => {:validate_mx => false}
|
15
|
-
end
|
16
|
-
|
17
|
-
class ValidateEmailDisabledIdm
|
18
|
-
include ActiveModel::Validations
|
19
|
-
attr_accessor :email
|
20
|
-
validates :email, :email => {:allow_idn => false}
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
class TestRailsEmailValidator < Test::Unit::TestCase
|
25
|
-
|
26
|
-
|
27
|
-
def test_valid_emails_with_mx_validation
|
28
|
-
model = ValidateEmailWithMx.new
|
29
|
-
|
30
|
-
[
|
31
|
-
'test@marco-scholl.de'
|
32
|
-
].each do |email|
|
33
|
-
|
34
|
-
model.email = email
|
35
|
-
assert model.valid?, ">>#{email}<<"
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_invalid_emails_with_mx_validation
|
41
|
-
model = ValidateEmailWithMx.new
|
42
|
-
|
43
|
-
[
|
44
|
-
'test@invalidmx.marco-scholl.de'
|
45
|
-
].each do |email|
|
46
|
-
|
47
|
-
model.email = email
|
48
|
-
assert !model.valid?, ">>#{email}<<"
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
def test_valid_emails_without_mx_validation
|
55
|
-
model = ValidateEmailWithoutMx.new
|
56
|
-
|
57
|
-
[
|
58
|
-
nil,
|
59
|
-
'',
|
60
|
-
' ',
|
61
|
-
'test@example.net',
|
62
|
-
'test@sub1.example.net',
|
63
|
-
'test@sub1.example.co.uk',
|
64
|
-
'test@sub2.sub1.example.net',
|
65
|
-
'test@sub2.sub1.example.tttttttt',
|
66
|
-
'test@mexample.net.'
|
67
|
-
].each do |email|
|
68
|
-
|
69
|
-
model.email = email
|
70
|
-
assert model.valid?, ">>#{email}<<"
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_invalid_emails_without_mx_validation
|
76
|
-
model = ValidateEmailWithoutMx.new
|
77
|
-
|
78
|
-
[
|
79
|
-
1.2,
|
80
|
-
1,
|
81
|
-
'email',
|
82
|
-
'test@localhost',
|
83
|
-
'müller@example.net',
|
84
|
-
'test@example.net..'
|
85
|
-
].each do |email|
|
86
|
-
|
87
|
-
model.email = email
|
88
|
-
assert !model.valid?, ">>#{email}<<"
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_idn_adresses
|
94
|
-
model = ValidateEmailWithoutMx.new
|
95
|
-
|
96
|
-
[
|
97
|
-
'mueller@müller.de',
|
98
|
-
'test@räksmörgås.nu',
|
99
|
-
'test@sub1.räksmörgås.nu',
|
100
|
-
'test@xn--rksmrgs-5wao1o.nu',
|
101
|
-
'test@sub1.xn--rksmrgs-5wao1o.nu'
|
102
|
-
].each do |email|
|
103
|
-
|
104
|
-
model.email = email
|
105
|
-
assert model.valid?, ">>#{email}<<"
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_idn_with_disabled_idn_support
|
110
|
-
model = ValidateEmailDisabledIdm.new
|
111
|
-
|
112
|
-
[
|
113
|
-
'mueller@müller.de',
|
114
|
-
'test@räksmörgås.nu',
|
115
|
-
'test@sub1.räksmörgås.nu',
|
116
|
-
'test@xn--rksmrgs-5wao1o.nu',
|
117
|
-
'test@sub1.xn--rksmrgs-5wao1o.nu'
|
118
|
-
].each do |email|
|
119
|
-
|
120
|
-
model.email = email
|
121
|
-
assert !model.valid?, ">>#{email}<<"
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
end
|