credible_email 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.md +20 -0
- data/README.md +18 -0
- data/Rakefile +9 -0
- data/credible_email.gemspec +22 -0
- data/lib/credible_email.rb +1 -0
- data/lib/credible_email/email_validator.rb +7 -0
- data/lib/credible_email/version.rb +3 -0
- data/spec/credible_email_spec.rb +44 -0
- data/spec/spec_helper.rb +17 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a6ac36a6dddc9e3e47f42b49a9099c07fde5855e
|
4
|
+
data.tar.gz: e24cb2698c51a210998b43ea2bf64ff5b1a0f27e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4fee83fcd1a54b7e89a82962ac5c6cdab1c6ad125ad56278ae70a7573f58583f268ac6156e55b5443f219003ec9af8d48d9a36473c5d6b3298fde5939b43deff
|
7
|
+
data.tar.gz: 53ae6b15fa8e89b7a18fcd85f1566f491ac24a8e327cec075958a367ef0cb712f44f8e57a23cb842d7535a4c4a2b388bdb6a31856b248006c1ee90713b883371
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color --format d
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
credible_email (0.1.0)
|
5
|
+
activemodel (~> 4.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (4.1.1)
|
11
|
+
activesupport (= 4.1.1)
|
12
|
+
builder (~> 3.1)
|
13
|
+
activesupport (4.1.1)
|
14
|
+
i18n (~> 0.6, >= 0.6.9)
|
15
|
+
json (~> 1.7, >= 1.7.7)
|
16
|
+
minitest (~> 5.1)
|
17
|
+
thread_safe (~> 0.1)
|
18
|
+
tzinfo (~> 1.1)
|
19
|
+
builder (3.2.2)
|
20
|
+
diff-lcs (1.2.5)
|
21
|
+
i18n (0.6.9)
|
22
|
+
json (1.8.1)
|
23
|
+
minitest (5.3.4)
|
24
|
+
rake (0.9.6)
|
25
|
+
rspec (3.0.0.beta2)
|
26
|
+
rspec-core (= 3.0.0.beta2)
|
27
|
+
rspec-expectations (= 3.0.0.beta2)
|
28
|
+
rspec-mocks (= 3.0.0.beta2)
|
29
|
+
rspec-core (3.0.0.beta2)
|
30
|
+
rspec-support (= 3.0.0.beta2)
|
31
|
+
rspec-expectations (3.0.0.beta2)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (= 3.0.0.beta2)
|
34
|
+
rspec-mocks (3.0.0.beta2)
|
35
|
+
rspec-support (= 3.0.0.beta2)
|
36
|
+
rspec-support (3.0.0.beta2)
|
37
|
+
thread_safe (0.3.3)
|
38
|
+
tzinfo (1.1.0)
|
39
|
+
thread_safe (~> 0.1)
|
40
|
+
|
41
|
+
PLATFORMS
|
42
|
+
ruby
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
credible_email!
|
46
|
+
rake (~> 0)
|
47
|
+
rspec (= 3.0.0.beta2)
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# License
|
2
|
+
|
3
|
+
Copyright © 2014 [Daniel Morris](https://github.com/unfunco)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Credible Email
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/unfunco/credible_email.svg?branch=master)](https://travis-ci.org/unfunco/credible_email)
|
4
|
+
|
5
|
+
Under-engineered email validation for Rails.
|
6
|
+
|
7
|
+
## Installation and usage
|
8
|
+
|
9
|
+
1. Add `gem 'credible_email'` to your Gemfile.
|
10
|
+
2. Run `bundle install`
|
11
|
+
3. Add `validates :email, email: true` to your model.
|
12
|
+
|
13
|
+
## License
|
14
|
+
|
15
|
+
Copyright © 2014 [Daniel Morris](https://github.com/unfunco)
|
16
|
+
|
17
|
+
The repository is made available under the terms of the
|
18
|
+
[MIT License](LICENSE.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'credible_email/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'credible_email'
|
7
|
+
s.summary = 'Under-engineered email validation'
|
8
|
+
s.description = 'An under-engineered email validator for Rails'
|
9
|
+
s.version = CredibleEmail::VERSION
|
10
|
+
s.authors = ['Daniel Morris']
|
11
|
+
s.email = %w(daniel@honestempire.com)
|
12
|
+
s.files = `git ls-files`.split($\)
|
13
|
+
s.test_files = `git ls-files -- spec/*`.split($\)
|
14
|
+
s.homepage = 'https://github.com/unfunco/credible_email'
|
15
|
+
s.license = 'MIT'
|
16
|
+
s.require_paths = %w(lib)
|
17
|
+
|
18
|
+
s.add_dependency('activemodel', '~> 4.0')
|
19
|
+
|
20
|
+
s.add_development_dependency('rake', '~> 0')
|
21
|
+
s.add_development_dependency('rspec', '3.0.0.beta2')
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'credible_email/email_validator'
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CredibleEmail do
|
4
|
+
describe 'valid?' do
|
5
|
+
context 'given a valid email address' do
|
6
|
+
[
|
7
|
+
'daniel@honestempire.com',
|
8
|
+
'daniel.morris@honestempire.com',
|
9
|
+
'daniel@subdomain.honestempire.com',
|
10
|
+
'daniel@127.0.0.1',
|
11
|
+
'daniel@[127.0.0.1]',
|
12
|
+
'daniel+filter@honestempire.com',
|
13
|
+
'"daniel morris"@honestempire.com',
|
14
|
+
'466378@honestempire.com',
|
15
|
+
'daniel@honest-empire.com',
|
16
|
+
'daniel_morris.period@honest-empire.com',
|
17
|
+
'daniel@honestempire.museum',
|
18
|
+
'daniel@correcthorsebatterystaplecorrecthorsebatterystaple.com',
|
19
|
+
'd@h.e',
|
20
|
+
'daniel."honest empire"@honestempire.co.uk',
|
21
|
+
'hello@xn--ls8h.com'
|
22
|
+
].each do |email|
|
23
|
+
it "#{email} should be valid" do
|
24
|
+
expect(Person.new(email: email)).to be_valid
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'given an invalid email address' do
|
30
|
+
[
|
31
|
+
'daniel',
|
32
|
+
'daniel morris',
|
33
|
+
'@honestempire',
|
34
|
+
'@honestempire.com',
|
35
|
+
'daniel@honestempire .com',
|
36
|
+
'daniel@honestempire'
|
37
|
+
].each do |invalid_email|
|
38
|
+
it "#{invalid_email} should not be valid" do
|
39
|
+
expect(Person.new(email: invalid_email)).to_not be_valid
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_model'
|
2
|
+
require 'rspec'
|
3
|
+
require 'credible_email'
|
4
|
+
|
5
|
+
class Person
|
6
|
+
include ActiveModel::Validations
|
7
|
+
|
8
|
+
validates :email, email: true
|
9
|
+
|
10
|
+
def initialize(attributes = {})
|
11
|
+
@attributes = attributes
|
12
|
+
end
|
13
|
+
|
14
|
+
def read_attribute_for_validation(key)
|
15
|
+
@attributes[key]
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: credible_email
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Morris
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activemodel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0.beta2
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0.beta2
|
55
|
+
description: An under-engineered email validator for Rails
|
56
|
+
email:
|
57
|
+
- daniel@honestempire.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.md
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- credible_email.gemspec
|
71
|
+
- lib/credible_email.rb
|
72
|
+
- lib/credible_email/email_validator.rb
|
73
|
+
- lib/credible_email/version.rb
|
74
|
+
- spec/credible_email_spec.rb
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
homepage: https://github.com/unfunco/credible_email
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.2.0
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Under-engineered email validation
|
100
|
+
test_files:
|
101
|
+
- spec/credible_email_spec.rb
|
102
|
+
- spec/spec_helper.rb
|