validates_phone_format_of 1.0.2 → 1.0.3
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 +4 -4
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +20 -0
- data/README.md +6 -0
- data/gemfiles/Gemfile.active_model_2_1 +5 -0
- data/gemfiles/Gemfile.active_model_3_0 +5 -0
- data/gemfiles/Gemfile.active_model_3_1 +5 -0
- data/gemfiles/Gemfile.active_model_3_2 +5 -0
- data/gemfiles/Gemfile.active_model_3_3 +5 -0
- data/gemfiles/Gemfile.active_model_4_0 +5 -0
- data/gemfiles/Gemfile.active_model_4_1 +5 -0
- data/gemfiles/Gemfile.active_model_5_0 +5 -0
- data/spec/validates_phone_format_of_spec.rb +39 -0
- data/validates_phone_format_of.gemspec +4 -1
- metadata +47 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce9d1af20d757dc9483bef1db36945ec75558cc2
|
4
|
+
data.tar.gz: a81caeda899882e2bc88854eab5fb8a9e5a30dad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b758de166944dae7b30443e7dcf8350ecb41018df3f813cc19975b1e70600db99139645893e3c982f6a4f4dacca71887d26112f633845a74f958ce644f4793f
|
7
|
+
data.tar.gz: 724c346aee60f8a07390b4baf7bfa7756845fb13091456f0b62e85a7445db6f3f531176412002f2280aee33895345f971a296c60238c75569fe94738acadb973
|
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
validates_phone_format_of
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.0
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
rvm:
|
2
|
+
- 1.8.7
|
3
|
+
- 1.9.2
|
4
|
+
- 1.9.3
|
5
|
+
- 2.0.0
|
6
|
+
- 2.1.2
|
7
|
+
- 2.4.0
|
8
|
+
- jruby
|
9
|
+
- ree
|
10
|
+
gemfile:
|
11
|
+
- Gemfile
|
12
|
+
- gemfiles/active_model_2_1
|
13
|
+
- gemfiles/active_model_3_0
|
14
|
+
- gemfiles/active_model_3_1
|
15
|
+
- gemfiles/active_model_3_2
|
16
|
+
- gemfiles/active_model_4_0
|
17
|
+
- gemfiles/active_model_4_1
|
18
|
+
- gemfiles/active_model_5_0
|
19
|
+
install: bundle install
|
20
|
+
script: bundle exec rspec
|
data/README.md
CHANGED
@@ -31,6 +31,12 @@ class User < ActiveRecord::Base
|
|
31
31
|
end
|
32
32
|
```
|
33
33
|
|
34
|
+
## Others libraries useful
|
35
|
+
|
36
|
+
- [intl-tel-input](https://github.com/jackocnr/intl-tel-input) Javascript library forcing users to set the region
|
37
|
+
- [intl-tel-input-rails](https://github.com/jonathantribouharet/intl-tel-input-rails) Gem for `intl-tel-input`
|
38
|
+
- [global_phone](https://github.com/sstephenson/global_phone)
|
39
|
+
|
34
40
|
## Author
|
35
41
|
|
36
42
|
- [Jonathan Tribouharet](https://github.com/jonathantribouharet) ([@johntribouharet](https://twitter.com/johntribouharet))
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "validates_phone_format_of"
|
2
|
+
|
3
|
+
describe ValidatesPhoneFormatOf do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@user_class = Class.new do
|
7
|
+
|
8
|
+
include ActiveModel::Validations
|
9
|
+
|
10
|
+
attr_reader :phone
|
11
|
+
|
12
|
+
def initialize(phone)
|
13
|
+
@phone = phone.freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.model_name
|
17
|
+
ActiveModel::Name.new(self, nil, "user")
|
18
|
+
end
|
19
|
+
|
20
|
+
validates_phone_format_of :phone
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
['+12223335555', '+33123456789', '+13125551212'].each do |phone|
|
25
|
+
it "#{phone} is valid" do
|
26
|
+
user = @user_class.new(phone)
|
27
|
+
expect(user.valid?).to be_truthy
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
['test', '0000', '(312) 555-1212'].each do |phone|
|
32
|
+
it "#{phone} is not valid" do
|
33
|
+
user = @user_class.new(phone)
|
34
|
+
expect(user.valid?).to_not be_truthy
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
@@ -5,11 +5,14 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.summary = "Validate phone numbers against E.164 format with this Ruby on Rails gem"
|
6
6
|
s.description = s.summary
|
7
7
|
s.homepage = 'https://github.com/jonathantribouharet/validates_phone_format_of'
|
8
|
-
s.version = '1.0.
|
8
|
+
s.version = '1.0.3'
|
9
9
|
s.files = `git ls-files`.split("\n")
|
10
10
|
s.require_paths = ['lib']
|
11
11
|
s.authors = ['Jonathan TRIBOUHARET']
|
12
12
|
s.email = 'jonathan.tribouharet@gmail.com'
|
13
13
|
s.license = 'MIT'
|
14
14
|
s.platform = Gem::Platform::RUBY
|
15
|
+
|
16
|
+
s.add_development_dependency 'bundler', '~> 1.10'
|
17
|
+
s.add_development_dependency 'rspec', '~> 3.6'
|
15
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_phone_format_of
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan TRIBOUHARET
|
@@ -9,18 +9,59 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2017-05-20 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.6'
|
13
41
|
description: Validate phone numbers against E.164 format with this Ruby on Rails gem
|
14
42
|
email: jonathan.tribouharet@gmail.com
|
15
43
|
executables: []
|
16
44
|
extensions: []
|
17
45
|
extra_rdoc_files: []
|
18
46
|
files:
|
19
|
-
- .gitignore
|
47
|
+
- ".gitignore"
|
48
|
+
- ".rspec"
|
49
|
+
- ".ruby-gemset"
|
50
|
+
- ".ruby-version"
|
51
|
+
- ".travis.yml"
|
20
52
|
- Gemfile
|
21
53
|
- LICENSE
|
22
54
|
- README.md
|
55
|
+
- gemfiles/Gemfile.active_model_2_1
|
56
|
+
- gemfiles/Gemfile.active_model_3_0
|
57
|
+
- gemfiles/Gemfile.active_model_3_1
|
58
|
+
- gemfiles/Gemfile.active_model_3_2
|
59
|
+
- gemfiles/Gemfile.active_model_3_3
|
60
|
+
- gemfiles/Gemfile.active_model_4_0
|
61
|
+
- gemfiles/Gemfile.active_model_4_1
|
62
|
+
- gemfiles/Gemfile.active_model_5_0
|
23
63
|
- lib/validates_phone_format_of.rb
|
64
|
+
- spec/validates_phone_format_of_spec.rb
|
24
65
|
- validates_phone_format_of.gemspec
|
25
66
|
homepage: https://github.com/jonathantribouharet/validates_phone_format_of
|
26
67
|
licenses:
|
@@ -32,17 +73,17 @@ require_paths:
|
|
32
73
|
- lib
|
33
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
34
75
|
requirements:
|
35
|
-
- -
|
76
|
+
- - ">="
|
36
77
|
- !ruby/object:Gem::Version
|
37
78
|
version: '0'
|
38
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
80
|
requirements:
|
40
|
-
- -
|
81
|
+
- - ">="
|
41
82
|
- !ruby/object:Gem::Version
|
42
83
|
version: '0'
|
43
84
|
requirements: []
|
44
85
|
rubyforge_project:
|
45
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.6.8
|
46
87
|
signing_key:
|
47
88
|
specification_version: 4
|
48
89
|
summary: Validate phone numbers against E.164 format with this Ruby on Rails gem
|