phony_rails 0.14.6 → 0.14.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5286e498c6adb68558671f8441c33298b4f21ceb
4
- data.tar.gz: 43c4bac232facb55347ce9ea716fac1a9c0d98ec
3
+ metadata.gz: 61c4c27ba9b21ca10478542b5ba5f87112b0566e
4
+ data.tar.gz: f081e0772586515e34ff639dc1839152a9a19d62
5
5
  SHA512:
6
- metadata.gz: b467fdaa24310f98b25e1a8a6734f7e13c891c8eaa326d8911cee36f7428bd18ad8e6441aa5304c8ce2b6b4cc9ae6d8a45bfb426b83029237c2afeeba1a6c41a
7
- data.tar.gz: e93e196d750c260dea3028206070e2fddfe5c7b57b5bf26bd8b487ec73dca41848743813d0d2c669cf039eae836bf061a6252c60a833d6b807faac670687189d
6
+ metadata.gz: f24f3dbb6851ae7e5ef4886a9ac78c316aa735632b02e3083a18c0b7966d34e846f212532aca21db4b315c9c0d54837d6c39c9f5d53735081e9280a47b24e25a
7
+ data.tar.gz: 67ede59cd91fe43798eefbb839b3bf17f02e817ce9bd779021f33fad736dee1a34a7ab5f97ff5996e3daf924a16f854f5d8c501154e95a3431cedd48bd7caac3
@@ -1,3 +1,5 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
  AllCops:
3
- TargetRubyVersion: 2.0
3
+ TargetRubyVersion: 2.3
4
+ Metrics/BlockLength:
5
+ ExcludedMethods: ['describe', 'context', 'define', 'shared_examples_for']
@@ -1,14 +1,45 @@
1
1
  # Change Log
2
2
 
3
- ## [Unreleased](https://github.com/joost/phony_rails/tree/HEAD)
3
+ ## [v0.14.6](https://github.com/joost/phony_rails/tree/v0.14.6) (2017-06-20)
4
+ [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.5...v0.14.6)
4
5
 
5
- [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.2...HEAD)
6
+ **Closed issues:**
7
+
8
+ - Fail validation on raw input [\#161](https://github.com/joost/phony_rails/issues/161)
9
+ - Extension example in README does not work [\#155](https://github.com/joost/phony_rails/issues/155)
10
+ - Switching the dependancy from `ActiveRecord::Base` to `ActiveModel::Model` breaks support for Rails 3 apps [\#147](https://github.com/joost/phony_rails/issues/147)
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Conditional Normalization [\#166](https://github.com/joost/phony_rails/pull/166) ([Ross-Hunter](https://github.com/Ross-Hunter))
15
+ - Fixed belongs\_to\_required\_by\_default in Rails 5 [\#158](https://github.com/joost/phony_rails/pull/158) ([olivierpichon](https://github.com/olivierpichon))
16
+ - `subbed` always return number [\#157](https://github.com/joost/phony_rails/pull/157) ([mrclmrvn](https://github.com/mrclmrvn))
17
+
18
+ ## [v0.14.5](https://github.com/joost/phony_rails/tree/v0.14.5) (2017-02-08)
19
+ [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.4...v0.14.5)
20
+
21
+ **Closed issues:**
22
+
23
+ - phone number not being validated [\#154](https://github.com/joost/phony_rails/issues/154)
24
+ - Make phony\_normalize optional, on condition [\#149](https://github.com/joost/phony_rails/issues/149)
25
+
26
+ **Merged pull requests:**
27
+
28
+ - Fix Rails 3 compatibility in issue \#147 [\#156](https://github.com/joost/phony_rails/pull/156) ([wvanheerde](https://github.com/wvanheerde))
29
+ - Support of phone numbers with extension in validator [\#153](https://github.com/joost/phony_rails/pull/153) ([Kukunin](https://github.com/Kukunin))
30
+
31
+ ## [v0.14.4](https://github.com/joost/phony_rails/tree/v0.14.4) (2016-10-10)
32
+ [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.2...v0.14.4)
6
33
 
7
34
  **Closed issues:**
8
35
 
9
36
  - Add support for internal Russian phone style \(8 926 ... instead of +7 926 ...\) [\#148](https://github.com/joost/phony_rails/issues/148)
10
37
  - is it necessary to extend ActiveRecord::Base instead of ActiveModel::Model ? [\#143](https://github.com/joost/phony_rails/issues/143)
11
38
 
39
+ **Merged pull requests:**
40
+
41
+ - Bundle updates and fixes Travis [\#151](https://github.com/joost/phony_rails/pull/151) ([joost](https://github.com/joost))
42
+
12
43
  ## [v0.14.2](https://github.com/joost/phony_rails/tree/v0.14.2) (2016-06-16)
13
44
  [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.1...v0.14.2)
14
45
 
@@ -313,8 +344,8 @@
313
344
  - Mongoid support. [\#14](https://github.com/joost/phony_rails/pull/14) ([siong1987](https://github.com/siong1987))
314
345
  - Do not pollute the global namespace with a Country class [\#13](https://github.com/joost/phony_rails/pull/13) ([Jell](https://github.com/Jell))
315
346
  - Address issue \#11 - need to use a newer version of phony for additional countries [\#12](https://github.com/joost/phony_rails/pull/12) ([rjhaveri](https://github.com/rjhaveri))
316
- - Compatibility with Ruby 1.8.7 [\#10](https://github.com/joost/phony_rails/pull/10) ([henning-koch](https://github.com/henning-koch))
317
- - remove cause for warning: already initialized constant VERSION [\#9](https://github.com/joost/phony_rails/pull/9) ([henning-koch](https://github.com/henning-koch))
347
+ - Compatibility with Ruby 1.8.7 [\#10](https://github.com/joost/phony_rails/pull/10) ([triskweline](https://github.com/triskweline))
348
+ - remove cause for warning: already initialized constant VERSION [\#9](https://github.com/joost/phony_rails/pull/9) ([triskweline](https://github.com/triskweline))
318
349
  - validator translation [\#8](https://github.com/joost/phony_rails/pull/8) ([ddidier](https://github.com/ddidier))
319
350
  - refactored tests and added options to validates\_plausible\_phone [\#6](https://github.com/joost/phony_rails/pull/6) ([ddidier](https://github.com/ddidier))
320
351
  - some tests and a helper method [\#5](https://github.com/joost/phony_rails/pull/5) ([ddidier](https://github.com/ddidier))
data/Gemfile CHANGED
@@ -1,15 +1,16 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
 
4
5
  gemspec # Specify your gem's dependencies in phony_number.gemspec
5
6
 
6
- # For testing
7
- gem 'sqlite3'
8
-
9
- gem 'rake'
10
- gem 'rspec' # , '~> 2.14.0'
7
+ gem 'coveralls', require: false
11
8
  gem 'guard' # , '~> 2.10.1'
12
9
  gem 'guard-bundler' # , '~> 2.0.0'
13
10
  gem 'guard-rspec' # , '~> 4.2.0'
14
- gem 'coveralls', require: false
11
+ gem 'rake'
12
+ gem 'rspec' # , '~> 2.14.0'
15
13
  gem 'rubocop'
14
+
15
+ # For testing
16
+ gem 'sqlite3'
@@ -1,28 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phony_rails (0.14.6)
4
+ phony_rails (0.14.7)
5
5
  activesupport (>= 3.0)
6
6
  phony (> 2.15)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (5.1.1)
12
- activesupport (= 5.1.1)
13
- activerecord (5.1.1)
14
- activemodel (= 5.1.1)
15
- activesupport (= 5.1.1)
11
+ activemodel (5.1.4)
12
+ activesupport (= 5.1.4)
13
+ activerecord (5.1.4)
14
+ activemodel (= 5.1.4)
15
+ activesupport (= 5.1.4)
16
16
  arel (~> 8.0)
17
- activesupport (5.1.1)
17
+ activesupport (5.1.4)
18
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
19
  i18n (~> 0.7)
20
20
  minitest (~> 5.1)
21
21
  tzinfo (~> 1.1)
22
22
  arel (8.0.0)
23
23
  ast (2.3.0)
24
- bson (4.2.1)
25
- coderay (1.1.1)
24
+ bson (4.2.2)
25
+ coderay (1.1.2)
26
26
  concurrent-ruby (1.0.5)
27
27
  coveralls (0.8.21)
28
28
  json (>= 1.8, < 3)
@@ -52,77 +52,76 @@ GEM
52
52
  guard (~> 2.1)
53
53
  guard-compat (~> 1.1)
54
54
  rspec (>= 2.99.0, < 4.0)
55
- i18n (0.8.4)
55
+ i18n (0.9.1)
56
+ concurrent-ruby (~> 1.0)
56
57
  json (2.1.0)
57
58
  listen (3.1.5)
58
59
  rb-fsevent (~> 0.9, >= 0.9.4)
59
60
  rb-inotify (~> 0.9, >= 0.9.7)
60
61
  ruby_dep (~> 1.2)
61
62
  lumberjack (1.0.12)
62
- method_source (0.8.2)
63
- minitest (5.10.2)
64
- mongo (2.4.2)
63
+ method_source (0.9.0)
64
+ minitest (5.10.3)
65
+ mongo (2.4.3)
65
66
  bson (>= 4.2.1, < 5.0.0)
66
- mongoid (6.2.0)
67
+ mongoid (6.2.1)
67
68
  activemodel (~> 5.1)
68
69
  mongo (>= 2.4.1, < 3.0.0)
69
70
  nenv (0.3.0)
70
71
  notiffany (0.1.1)
71
72
  nenv (~> 0.1)
72
73
  shellany (~> 0.0)
73
- parallel (1.11.2)
74
- parser (2.4.0.0)
75
- ast (~> 2.2)
76
- phony (2.15.44)
74
+ parallel (1.12.0)
75
+ parser (2.4.0.2)
76
+ ast (~> 2.3)
77
+ phony (2.16.3)
77
78
  powerpack (0.1.1)
78
- pry (0.10.4)
79
+ pry (0.11.3)
79
80
  coderay (~> 1.1.0)
80
- method_source (~> 0.8.1)
81
- slop (~> 3.4)
81
+ method_source (~> 0.9.0)
82
82
  rainbow (2.2.2)
83
83
  rake
84
- rake (12.0.0)
85
- rb-fsevent (0.9.8)
84
+ rake (12.3.0)
85
+ rb-fsevent (0.10.2)
86
86
  rb-inotify (0.9.10)
87
87
  ffi (>= 0.5.0, < 2)
88
- rspec (3.6.0)
89
- rspec-core (~> 3.6.0)
90
- rspec-expectations (~> 3.6.0)
91
- rspec-mocks (~> 3.6.0)
92
- rspec-core (3.6.0)
93
- rspec-support (~> 3.6.0)
94
- rspec-expectations (3.6.0)
88
+ rspec (3.7.0)
89
+ rspec-core (~> 3.7.0)
90
+ rspec-expectations (~> 3.7.0)
91
+ rspec-mocks (~> 3.7.0)
92
+ rspec-core (3.7.0)
93
+ rspec-support (~> 3.7.0)
94
+ rspec-expectations (3.7.0)
95
95
  diff-lcs (>= 1.2.0, < 2.0)
96
- rspec-support (~> 3.6.0)
97
- rspec-mocks (3.6.0)
96
+ rspec-support (~> 3.7.0)
97
+ rspec-mocks (3.7.0)
98
98
  diff-lcs (>= 1.2.0, < 2.0)
99
- rspec-support (~> 3.6.0)
100
- rspec-support (3.6.0)
101
- rubocop (0.49.1)
99
+ rspec-support (~> 3.7.0)
100
+ rspec-support (3.7.0)
101
+ rubocop (0.51.0)
102
102
  parallel (~> 1.10)
103
103
  parser (>= 2.3.3.1, < 3.0)
104
104
  powerpack (~> 0.1)
105
- rainbow (>= 1.99.1, < 3.0)
105
+ rainbow (>= 2.2.2, < 3.0)
106
106
  ruby-progressbar (~> 1.7)
107
107
  unicode-display_width (~> 1.0, >= 1.0.1)
108
- ruby-progressbar (1.8.1)
108
+ ruby-progressbar (1.9.0)
109
109
  ruby_dep (1.5.0)
110
110
  shellany (0.0.1)
111
111
  simplecov (0.14.1)
112
112
  docile (~> 1.1.0)
113
113
  json (>= 1.8, < 3)
114
114
  simplecov-html (~> 0.10.0)
115
- simplecov-html (0.10.1)
116
- slop (3.6.0)
115
+ simplecov-html (0.10.2)
117
116
  sqlite3 (1.3.13)
118
117
  term-ansicolor (1.6.0)
119
118
  tins (~> 1.0)
120
119
  thor (0.19.4)
121
120
  thread_safe (0.3.6)
122
- tins (1.14.0)
123
- tzinfo (1.2.3)
121
+ tins (1.15.1)
122
+ tzinfo (1.2.4)
124
123
  thread_safe (~> 0.1)
125
- unicode-display_width (1.2.1)
124
+ unicode-display_width (1.3.0)
126
125
 
127
126
  PLATFORMS
128
127
  ruby
@@ -141,4 +140,4 @@ DEPENDENCIES
141
140
  sqlite3
142
141
 
143
142
  BUNDLED WITH
144
- 1.13.5
143
+ 1.16.1
data/Guardfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # More info at https://github.com/guard/guard#readme
3
4
 
4
5
  guard 'bundler' do
data/README.md CHANGED
@@ -151,7 +151,7 @@ You can validate against the normalized input as opposed to the raw input:
151
151
 
152
152
  ```ruby
153
153
  phony_normalize :phone_number, as: :phone_number_normalized, default_country_code: 'US'
154
- validates_plausible_phone :phone_number, normalized_country_code: 'US'
154
+ validates_plausible_phone :phone_number_normalized, presence: true, if: :phone_number?
155
155
  ```
156
156
 
157
157
  Validation supports phone numbers with extension, such as `+18181231234 x1234` or `'+1 (818)151-5483 #4312'` out-of-the-box.
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env rake
2
2
  # frozen_string_literal: true
3
+
3
4
  require 'bundler/gem_tasks'
4
5
  require 'rspec/core/rake_task'
5
6
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'phony'
3
4
  require 'phony_rails/string_extensions'
4
5
  require 'validators/phony_validator'
@@ -40,6 +41,7 @@ module PhonyRails
40
41
  # :country_code => The country code we should use.
41
42
  # :default_country_code => Some fallback code (eg. 'NL') that can be used as default (comes from phony_normalize_numbers method).
42
43
  # :add_plus => Add a '+' in front so we know the country code is added. (default: true)
44
+ # :extension => Include the extension. (default: true)
43
45
  # This idea came from:
44
46
  # http://www.redguava.com.au/2011/06/rails-convert-phone-numbers-to-international-format-for-sms/
45
47
  def self.normalize_number(number, options = {})
@@ -63,8 +65,11 @@ module PhonyRails
63
65
  normalized_number = Phony.normalize(number)
64
66
  options[:add_plus] = true if options[:add_plus].nil? && Phony.plausible?(normalized_number)
65
67
  normalized_number = options[:add_plus] ? "+#{normalized_number}" : normalized_number
66
- format_extension(normalized_number, ext)
67
- rescue
68
+
69
+ options[:extension] = true if options[:extension].nil?
70
+ normalized_number = options[:extension] ? format_extension(normalized_number, ext) : normalized_number
71
+ normalized_number
72
+ rescue StandardError
68
73
  original_number # If all goes wrong .. we still return the original input.
69
74
  end
70
75
 
@@ -92,6 +97,11 @@ module PhonyRails
92
97
  Phony.split(Phony.normalize(number)).first
93
98
  end
94
99
 
100
+ def self.country_from_number(number)
101
+ return nil unless Phony.plausible?(number)
102
+ country_codes_hash.select { |_country, hash| hash['country_code'] == country_code_from_number(number) }.keys[0]
103
+ end
104
+
95
105
  # Wrapper for Phony.plausible?. Takes the same options as #normalize_number.
96
106
  # NB: This method calls #normalize_number and passes _options_ directly to that method.
97
107
  def self.plausible_number?(number, options = {})
@@ -102,7 +112,7 @@ module PhonyRails
102
112
  options[:default_country_number] || country_number_for(options[:default_country_code]) ||
103
113
  default_country_number
104
114
  Phony.plausible? number, cc: country_number
105
- rescue
115
+ rescue StandardError
106
116
  false
107
117
  end
108
118
 
@@ -142,7 +152,7 @@ module PhonyRails
142
152
  end
143
153
 
144
154
  def assign_values_for_phony_symbol_options(options)
145
- symbol_options = [:country_number, :default_country_number, :country_code, :default_country_code]
155
+ symbol_options = %i[country_number default_country_number country_code default_country_code]
146
156
  symbol_options.each do |option|
147
157
  options[option] = send(options[option]) if options[option].is_a?(Symbol)
148
158
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class String
3
4
  # Usage:
4
5
  # "+31 (0)30 1234 123".phony_normalized # => '+31301234123'
@@ -30,7 +31,7 @@ class String
30
31
  return if s.blank?
31
32
  return if options[:strict] && !Phony.plausible?(s)
32
33
  PhonyRails.format_extension(Phony.format(s, options.reverse_merge(format: :national)), ext)
33
- rescue
34
+ rescue StandardError
34
35
  raise if options[:raise]
35
36
  s
36
37
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module PhonyRails
3
- VERSION = '0.14.6'.freeze
4
+ VERSION = '0.14.7'
4
5
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Uses the Phony.plausible method to validate an attribute.
3
4
  # Usage:
4
5
  # validate :phone_number, :phony_plausible => true
@@ -1,5 +1,5 @@
1
- # -*- encoding: utf-8 -*-
2
1
  # frozen_string_literal: true
2
+
3
3
  require File.expand_path('../lib/phony_rails/version', __FILE__)
4
4
 
5
5
  Gem::Specification.new do |gem|
@@ -20,8 +20,8 @@ Gem::Specification.new do |gem|
20
20
  gem.post_install_message = 'PhonyRails v0.10.0 changes the way numbers are stored!'
21
21
  gem.post_install_message = "It now adds a '+' to the normalized number when it starts with a country number!"
22
22
 
23
- gem.add_runtime_dependency 'phony', '> 2.15'
24
23
  gem.add_runtime_dependency 'activesupport', '>= 3.0'
24
+ gem.add_runtime_dependency 'phony', '> 2.15'
25
25
  gem.add_development_dependency 'activerecord', '>= 3.0'
26
26
  gem.add_development_dependency 'mongoid', '>= 3.0'
27
27
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'spec_helper'
3
4
 
4
5
  describe PhonyRails do
5
- EXT_PREFIXES = %w(ext ex x xt # :).freeze
6
+ EXT_PREFIXES = %w[ext ex x xt # :].freeze
6
7
 
7
8
  it 'should not pollute the global namespace with a Country class' do
8
9
  should_not be_const_defined 'Country'
@@ -74,7 +75,7 @@ describe PhonyRails do
74
75
  it 'should raise the error' do
75
76
  expect(lambda do
76
77
  '8887716095'.phony_formatted(format: :international, raise: true)
77
- end).to raise_error(NoMethodError)
78
+ end).to raise_error(Phony::FormattingError)
78
79
  end
79
80
  end
80
81
 
@@ -211,6 +212,12 @@ describe PhonyRails do
211
212
  expect(normal.phone_number).to eq('HAHA')
212
213
  expect(normal.errors.messages).to include(phone_number: ['is an invalid number'])
213
214
  end
215
+
216
+ it 'should pass Github issue #170' do
217
+ phone = '(+49) 175 123 4567'
218
+ phone = PhonyRails.normalize_number(phone)
219
+ expect(phone).to eq('+491751234567')
220
+ end
214
221
  end
215
222
 
216
223
  it 'should not change original String' do
@@ -335,6 +342,12 @@ describe PhonyRails do
335
342
  expect(PhonyRails.normalize_number("+32 3 226 94 97#{prefix}123", default_country_code: 'BE')).to eql('+3232269497 x123')
336
343
  expect(PhonyRails.normalize_number("0450 764 000#{prefix}123", default_country_code: 'AU')).to eql('+61450764000 x123')
337
344
  end
345
+
346
+ it "should remove #{prefix} extension (with extension: false)" do
347
+ expect(PhonyRails.normalize_number("0031-70-4157134#{prefix}123", extension: false, country_code: 'NL')).to eql('+31704157134')
348
+ expect(PhonyRails.normalize_number("+31-70-4157134#{prefix}123", extension: false, country_code: 'NL')).to eql('+31704157134')
349
+ expect(PhonyRails.normalize_number("0322-69497#{prefix}123", extension: false, country_code: 'BE')).to eql('+3232269497')
350
+ end
338
351
  end
339
352
  end
340
353
 
@@ -477,11 +490,17 @@ describe PhonyRails do
477
490
 
478
491
  EXT_PREFIXES.each do |prefix|
479
492
  it "returns [number, ext] when number has a #{prefix} extension" do
480
- expect(PhonyRails.extract_extension("123456789#{prefix}123")).to eq %w(123456789 123)
493
+ expect(PhonyRails.extract_extension("123456789#{prefix}123")).to eq %w[123456789 123]
481
494
  end
482
495
  end
483
496
  end
484
497
 
498
+ describe 'PhonyRails.country_from_number' do
499
+ it 'returns the country of the plausible phone number' do
500
+ expect(PhonyRails.country_from_number('+32475000000')).to eq 'BE'
501
+ end
502
+ end
503
+
485
504
  describe 'PhonyRails#format_extension' do
486
505
  it 'returns just number if no extension' do
487
506
  expect(PhonyRails.format_extension('+123456789', nil)).to eq '+123456789'
@@ -548,7 +567,7 @@ describe PhonyRails do
548
567
  end
549
568
 
550
569
  it 'should accept supported options' do
551
- options = [:country_number, :default_country_number, :country_code, :default_country_code, :add_plus, :as, :enforce_record_country]
570
+ options = %i[country_number default_country_number country_code default_country_code add_plus as enforce_record_country]
552
571
  options.each do |option_sym|
553
572
  expect(lambda do
554
573
  dummy_klass.phony_normalize(:phone_number, option_sym => false)
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
1
  # frozen_string_literal: true
2
+
3
3
  require 'spec_helper'
4
4
 
5
5
  #-----------------------------------------------------------------------------------------------------------------------
@@ -171,18 +171,18 @@ end
171
171
  #-----------------------------------------------------------------------------------------------------------------------
172
172
 
173
173
  I18n.locale = :en
174
- VALID_NUMBER = '1 555 555 5555'.freeze
175
- VALID_NUMBER_WITH_EXTENSION = '1 555 555 5555 x123'.freeze
176
- VALID_NUMBER_WITH_INVALID_EXTENSION = '1 555 555 5555 x1a'.freeze
177
- NORMALIZABLE_NUMBER = '555 555 5555'.freeze
178
- AUSTRALIAN_NUMBER_WITH_COUNTRY_CODE = '61390133997'.freeze
179
- POLISH_NUMBER_WITH_COUNTRY_CODE = '48600600600'.freeze
180
- FORMATTED_AUSTRALIAN_NUMBER_WITH_COUNTRY_CODE = '+61 390133997'.freeze
181
- FRENCH_NUMBER_WITH_COUNTRY_CODE = '33627899541'.freeze
182
- FORMATTED_FRENCH_NUMBER_WITH_COUNTRY_CODE = '+33 627899541'.freeze
183
- INVALID_NUMBER = '123456789 123456789 123456789 123456789'.freeze
184
- NOT_A_NUMBER = 'HAHA'.freeze
185
- JAPAN_COUNTRY = 'jp'.freeze
174
+ VALID_NUMBER = '1 555 555 5555'
175
+ VALID_NUMBER_WITH_EXTENSION = '1 555 555 5555 x123'
176
+ VALID_NUMBER_WITH_INVALID_EXTENSION = '1 555 555 5555 x1a'
177
+ NORMALIZABLE_NUMBER = '555 555 5555'
178
+ AUSTRALIAN_NUMBER_WITH_COUNTRY_CODE = '61390133997'
179
+ POLISH_NUMBER_WITH_COUNTRY_CODE = '48600600600'
180
+ FORMATTED_AUSTRALIAN_NUMBER_WITH_COUNTRY_CODE = '+61 390133997'
181
+ FRENCH_NUMBER_WITH_COUNTRY_CODE = '33627899541'
182
+ FORMATTED_FRENCH_NUMBER_WITH_COUNTRY_CODE = '+33 627899541'
183
+ INVALID_NUMBER = '123456789 123456789 123456789 123456789'
184
+ NOT_A_NUMBER = 'HAHA'
185
+ JAPAN_COUNTRY = 'jp'
186
186
 
187
187
  #-----------------------------------------------------------------------------------------------------------------------
188
188
  describe PhonyPlausibleValidator do
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'coveralls'
3
4
  Coveralls.wear!
4
5
 
@@ -63,7 +64,8 @@ end
63
64
  class ActiveRecordDummy < ActiveRecordModel
64
65
  end
65
66
 
66
- class ActiveModelModel # in case you don't want a database for your model
67
+ # In case you don't want a database for your model
68
+ class ActiveModelModel
67
69
  include ActiveModel::Model # this provides most of the interface of AR
68
70
  include ActiveModel::Validations::Callbacks # we use callbacks for normalization
69
71
  include SharedModelMethods
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.6
4
+ version: 0.14.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Hietbrink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-20 00:00:00.000000000 Z
11
+ date: 2018-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: phony
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.15'
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.15'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: phony
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ">"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
33
+ version: '2.15'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ">"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.0'
40
+ version: '2.15'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement