phony_rails 0.14.3 → 0.14.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2158a8ba7eab9174c9cab0a88ebf160fa6d34fd7
4
- data.tar.gz: 276cdf0e95a728f2085eaa44ad0a750f37ded85f
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzI5ZjE3YTU1MjhiZTRiY2RjZjhhZDg0YjA0MGViZDNkNjI5OWVhYg==
5
+ data.tar.gz: !binary |-
6
+ OTc5ZGJhMTAyM2ZhNmVmNWZhODJmN2JiZWVjYzViMzNmMWUyY2NmNQ==
5
7
  SHA512:
6
- metadata.gz: 2d30b36dd460bc299ff96142c0f43a1d68a672f2d9dbfd9de8f2ff726038d861f476065d6b209fbae0c329c375614dfa4c17ec3d6e7c8805dcaa627b3f3cb8ea
7
- data.tar.gz: ad3deabb4ddaa86c4801e3f8c46a49da42ab47ec16681ea13beb0d1c14a0ae7fccd468729b85ac31cb8ee4f35c431617460e159e7cc22f09fdb330a209f2132b
8
+ metadata.gz: !binary |-
9
+ ODRhZGZmZDVjNjkxMjJiZjc3NGE3ZjI1NWFhYTg3OWQzMTJlMDc1ZTk0YTJm
10
+ Y2NjYzQ0MDczZWVjODM0ZDE4MzQ5YjRlNjA5NzIwOTczNWJiOWMxNmE0MTdj
11
+ Yzg2NjJlMjU5YTJkNDYwMWFlOWFiMDIwMTA3MDFjNWU0Yjk2N2E=
12
+ data.tar.gz: !binary |-
13
+ ZmMxYmY5NTU0MDcxOWJkN2JiMjY1NWU3MDhiNDA0MmUxMmZmNDc3OGM0YTMy
14
+ YmQ2M2M4NGRjNzQ1MzE2Yzg2ODk3ZDVlMGFmZjYyYzY5ZjUzNjA3ODIyM2Fm
15
+ MjM3MDdjZTU1NTc0OTlhNWU4ZTY1ZWZiMGI4MDI1MDJiOGIyNGM=
data/.rubocop.yml CHANGED
@@ -1 +1,3 @@
1
1
  inherit_from: .rubocop_todo.yml
2
+ AllCops:
3
+ TargetRubyVersion: 2.0
data/.rubocop_todo.yml CHANGED
@@ -29,7 +29,7 @@ Metrics/CyclomaticComplexity:
29
29
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
30
30
  # URISchemes: http, https
31
31
  Metrics/LineLength:
32
- Max: 166
32
+ Max: 177
33
33
 
34
34
  # Offense count: 4
35
35
  # Configuration parameters: CountComments.
data/.travis.yml CHANGED
@@ -1,6 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
- - '2.2.3'
3
+ - 2.2.5
4
+ - 2.3.1
4
5
  script:
5
- - bundle exec rspec spec
6
- - bundle exec rubocop
6
+ - bundle exec rspec spec
7
+ - bundle exec rubocop
8
+ deploy:
9
+ provider: rubygems
10
+ api_key:
11
+ secure: KP9HSdb/cWP66VD57MgLG3c3H6nlzWH0h6jF/j4Hi5ylJH1BcAU7FYB8ej2yj/WvCCk8Nwc6Pvr3xipAkDzRPCeDiZk0MPu0U+nnE+vlytZ3wmcoo0puDSRxn2KMjCv78ZdgbQkE3ik1a7TsmaxMMQGNrkT5ADDi2XHBneyCPYs=
12
+ on:
13
+ tags: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ ## [Unreleased](https://github.com/joost/phony_rails/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.2...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - Add support for internal Russian phone style \(8 926 ... instead of +7 926 ...\) [\#148](https://github.com/joost/phony_rails/issues/148)
10
+ - is it necessary to extend ActiveRecord::Base instead of ActiveModel::Model ? [\#143](https://github.com/joost/phony_rails/issues/143)
11
+
3
12
  ## [v0.14.2](https://github.com/joost/phony_rails/tree/v0.14.2) (2016-06-16)
4
13
  [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.1...v0.14.2)
5
14
 
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  gemspec # Specify your gem's dependencies in phony_number.gemspec
data/Gemfile.lock CHANGED
@@ -1,40 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phony_rails (0.14.2)
4
+ phony_rails (0.14.4)
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 (4.2.6)
12
- activesupport (= 4.2.6)
13
- builder (~> 3.1)
14
- activerecord (4.2.6)
15
- activemodel (= 4.2.6)
16
- activesupport (= 4.2.6)
17
- arel (~> 6.0)
18
- activesupport (4.2.6)
11
+ activemodel (5.0.0.1)
12
+ activesupport (= 5.0.0.1)
13
+ activerecord (5.0.0.1)
14
+ activemodel (= 5.0.0.1)
15
+ activesupport (= 5.0.0.1)
16
+ arel (~> 7.0)
17
+ activesupport (5.0.0.1)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
19
  i18n (~> 0.7)
20
- json (~> 1.7, >= 1.7.7)
21
20
  minitest (~> 5.1)
22
- thread_safe (~> 0.3, >= 0.3.4)
23
21
  tzinfo (~> 1.1)
24
- arel (6.0.3)
22
+ arel (7.1.4)
25
23
  ast (2.3.0)
26
24
  bson (4.1.1)
27
- builder (3.2.2)
28
25
  coderay (1.1.1)
29
- coveralls (0.8.13)
30
- json (~> 1.8)
31
- simplecov (~> 0.11.0)
26
+ concurrent-ruby (1.0.2)
27
+ coveralls (0.8.15)
28
+ json (>= 1.8, < 3)
29
+ simplecov (~> 0.12.0)
32
30
  term-ansicolor (~> 1.3)
33
31
  thor (~> 0.19.1)
34
- tins (~> 1.6.0)
32
+ tins (>= 1.6.0, < 2)
35
33
  diff-lcs (1.2.5)
36
34
  docile (1.1.5)
37
- ffi (1.9.10)
35
+ ffi (1.9.14)
38
36
  formatador (0.2.5)
39
37
  guard (2.14.0)
40
38
  formatador (>= 0.2.4)
@@ -50,81 +48,78 @@ GEM
50
48
  guard (~> 2.2)
51
49
  guard-compat (~> 1.1)
52
50
  guard-compat (1.2.1)
53
- guard-rspec (4.7.2)
51
+ guard-rspec (4.7.3)
54
52
  guard (~> 2.1)
55
53
  guard-compat (~> 1.1)
56
54
  rspec (>= 2.99.0, < 4.0)
57
55
  i18n (0.7.0)
58
- json (1.8.3)
56
+ json (2.0.2)
59
57
  listen (3.1.5)
60
58
  rb-fsevent (~> 0.9, >= 0.9.4)
61
59
  rb-inotify (~> 0.9, >= 0.9.7)
62
60
  ruby_dep (~> 1.2)
63
61
  lumberjack (1.0.10)
64
62
  method_source (0.8.2)
65
- minitest (5.9.0)
66
- mongo (2.2.5)
67
- bson (~> 4.0)
68
- mongoid (5.1.3)
69
- activemodel (~> 4.0)
70
- mongo (~> 2.1)
71
- origin (~> 2.2)
72
- tzinfo (>= 0.3.37)
63
+ minitest (5.9.1)
64
+ mongo (2.3.0)
65
+ bson (~> 4.1)
66
+ mongoid (6.0.0)
67
+ activemodel (~> 5.0)
68
+ mongo (~> 2.3)
73
69
  nenv (0.3.0)
74
- notiffany (0.1.0)
70
+ notiffany (0.1.1)
75
71
  nenv (~> 0.1)
76
72
  shellany (~> 0.0)
77
- origin (2.2.0)
78
- parser (2.3.1.2)
73
+ parser (2.3.1.4)
79
74
  ast (~> 2.2)
80
- phony (2.15.25)
75
+ phony (2.15.32)
81
76
  powerpack (0.1.1)
82
- pry (0.10.3)
77
+ pry (0.10.4)
83
78
  coderay (~> 1.1.0)
84
79
  method_source (~> 0.8.1)
85
80
  slop (~> 3.4)
86
81
  rainbow (2.1.0)
87
- rake (11.2.2)
82
+ rake (11.3.0)
88
83
  rb-fsevent (0.9.7)
89
84
  rb-inotify (0.9.7)
90
85
  ffi (>= 0.5.0)
91
- rspec (3.4.0)
92
- rspec-core (~> 3.4.0)
93
- rspec-expectations (~> 3.4.0)
94
- rspec-mocks (~> 3.4.0)
95
- rspec-core (3.4.4)
96
- rspec-support (~> 3.4.0)
97
- rspec-expectations (3.4.0)
86
+ rspec (3.5.0)
87
+ rspec-core (~> 3.5.0)
88
+ rspec-expectations (~> 3.5.0)
89
+ rspec-mocks (~> 3.5.0)
90
+ rspec-core (3.5.4)
91
+ rspec-support (~> 3.5.0)
92
+ rspec-expectations (3.5.0)
98
93
  diff-lcs (>= 1.2.0, < 2.0)
99
- rspec-support (~> 3.4.0)
100
- rspec-mocks (3.4.1)
94
+ rspec-support (~> 3.5.0)
95
+ rspec-mocks (3.5.0)
101
96
  diff-lcs (>= 1.2.0, < 2.0)
102
- rspec-support (~> 3.4.0)
103
- rspec-support (3.4.1)
104
- rubocop (0.40.0)
105
- parser (>= 2.3.1.0, < 3.0)
97
+ rspec-support (~> 3.5.0)
98
+ rspec-support (3.5.0)
99
+ rubocop (0.43.0)
100
+ parser (>= 2.3.1.1, < 3.0)
106
101
  powerpack (~> 0.1)
107
102
  rainbow (>= 1.99.1, < 3.0)
108
103
  ruby-progressbar (~> 1.7)
109
104
  unicode-display_width (~> 1.0, >= 1.0.1)
110
105
  ruby-progressbar (1.8.1)
111
- ruby_dep (1.3.1)
106
+ ruby_dep (1.5.0)
112
107
  shellany (0.0.1)
113
- simplecov (0.11.2)
108
+ simplecov (0.12.0)
114
109
  docile (~> 1.1.0)
115
- json (~> 1.8)
110
+ json (>= 1.8, < 3)
116
111
  simplecov-html (~> 0.10.0)
117
112
  simplecov-html (0.10.0)
118
113
  slop (3.6.0)
119
- sqlite3 (1.3.11)
120
- term-ansicolor (1.3.2)
114
+ sqlite3 (1.3.12)
115
+ term-ansicolor (1.4.0)
121
116
  tins (~> 1.0)
122
117
  thor (0.19.1)
123
118
  thread_safe (0.3.5)
124
- tins (1.6.0)
119
+ tins (1.12.0)
125
120
  tzinfo (1.2.2)
126
121
  thread_safe (~> 0.1)
127
- unicode-display_width (1.0.5)
122
+ unicode-display_width (1.1.1)
128
123
 
129
124
  PLATFORMS
130
125
  ruby
data/Guardfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # More info at https://github.com/guard/guard#readme
2
3
 
3
4
  guard 'bundler' do
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env rake
2
+ # frozen_string_literal: true
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rspec/core/rake_task'
4
5
 
data/lib/phony_rails.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'phony'
2
3
  require 'phony_rails/string_extensions'
3
4
  require 'validators/phony_validator'
@@ -71,14 +72,11 @@ module PhonyRails
71
72
  # We try to add the default country number and see if it is a
72
73
  # correct phone number. See https://github.com/joost/phony_rails/issues/87#issuecomment-89324426
73
74
  unless number =~ /\A\+/ # if we don't have a +
74
- if Phony.plausible?("#{default_country_number}#{number}") || !Phony.plausible?(number) || country_code_from_number(number).nil?
75
- return "#{default_country_number}#{number}"
76
- elsif (number =~ /^0[^0]/) && Phony.plausible?("#{default_country_number}#{number.gsub(/^0/, '')}")
77
- # If the number starts with ONE zero (two might indicate a country code)
78
- # and this is a plausible number for the default_country
79
- # we prefer that one.
80
- return "#{default_country_number}#{number.gsub(/^0/, '')}"
81
- end
75
+ return "#{default_country_number}#{number}" if Phony.plausible?("#{default_country_number}#{number}") || !Phony.plausible?(number) || country_code_from_number(number).nil?
76
+ # If the number starts with ONE zero (two might indicate a country code)
77
+ # and this is a plausible number for the default_country
78
+ # we prefer that one.
79
+ return "#{default_country_number}#{number.gsub(/^0/, '')}" if (number =~ /^0[^0]/) && Phony.plausible?("#{default_country_number}#{number.gsub(/^0/, '')}")
82
80
  end
83
81
  # number = "#{default_country_number}#{number}" unless Phony.plausible?(number)
84
82
  # Just return the number unchanged
@@ -97,7 +95,7 @@ module PhonyRails
97
95
  # Wrapper for Phony.plausible?. Takes the same options as #normalize_number.
98
96
  # NB: This method calls #normalize_number and passes _options_ directly to that method.
99
97
  def self.plausible_number?(number, options = {})
100
- return false if number.nil? || number.blank?
98
+ return false if number.blank?
101
99
  number = extract_extension(number).first
102
100
  number = normalize_number(number, options)
103
101
  country_number = options[:country_number] || country_number_for(options[:country_code]) ||
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class String
2
3
  # Usage:
3
4
  # "+31 (0)30 1234 123".phony_normalized # => '+31301234123'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module PhonyRails
2
- VERSION = '0.14.3'.freeze
3
+ VERSION = '0.14.4'.freeze
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Uses the Phony.plausible method to validate an attribute.
2
3
  # Usage:
3
4
  # validate :phone_number, :phony_plausible => true
data/phony_rails.gemspec CHANGED
@@ -1,4 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
  require File.expand_path('../lib/phony_rails/version', __FILE__)
3
4
 
4
5
  Gem::Specification.new do |gem|
@@ -19,8 +20,8 @@ Gem::Specification.new do |gem|
19
20
  gem.post_install_message = 'PhonyRails v0.10.0 changes the way numbers are stored!'
20
21
  gem.post_install_message = "It now adds a '+' to the normalized number when it starts with a country number!"
21
22
 
22
- gem.add_dependency 'phony', '~> 2.15'
23
- gem.add_dependency 'activesupport', '>= 3.0'
23
+ gem.add_runtime_dependency 'phony', '~> 2.15'
24
+ gem.add_runtime_dependency 'activesupport', '>= 3.0'
24
25
  gem.add_development_dependency 'activerecord', '>= 3.0'
25
26
  gem.add_development_dependency 'mongoid', '>= 3.0'
26
27
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe PhonyRails do
@@ -9,22 +10,23 @@ describe PhonyRails do
9
10
 
10
11
  describe 'phony_format String extension' do
11
12
  describe 'the phony_formatted method' do
12
- it 'should not modify the original options Hash' do
13
+ it 'does not modify the original options Hash' do
13
14
  options = { normalize: :NL, format: :international }
14
15
  '0101234123'.phony_formatted(options)
15
16
  expect(options).to eql(normalize: :NL, format: :international)
16
17
  end
17
18
 
18
19
  describe 'with the bang!' do
19
- it 'should change the String using the bang method' do
20
- s = '0101234123'
20
+ it 'changes the String using the bang method' do
21
+ # Mutable String
22
+ s = +'0101234123' rescue '0101234123' # rubocop:disable Style/RescueModifier
21
23
  expect(s.phony_formatted!(normalize: :NL, format: :international)).to eql('+31 10 123 4123')
22
24
  expect(s).to eql('+31 10 123 4123')
23
25
  end
24
26
  end
25
27
 
26
28
  describe 'with strict option' do
27
- it 'should return nil with non plausible number' do
29
+ it 'returns nil with non plausible number' do
28
30
  number = '+319090' # not valid
29
31
  expect(Phony.plausible?(number)).to be false
30
32
  expect(number.phony_formatted(strict: true)).to eql(nil)
@@ -77,7 +79,7 @@ describe PhonyRails do
77
79
  end
78
80
 
79
81
  context 'when raise is false (default)' do
80
- it 'should return original String on exception' do
82
+ it 'returns original String on exception' do
81
83
  expect('8887716095'.phony_formatted(format: :international)).to eq('8887716095')
82
84
  end
83
85
  end
@@ -393,35 +395,35 @@ describe PhonyRails do
393
395
  let(:empty_number) { '' }
394
396
  let(:nil_number) { nil }
395
397
 
396
- it 'should return true for a valid number' do
398
+ it 'returns true for a valid number' do
397
399
  is_expected.to be_plausible_number valid_number, country_code: 'US'
398
400
  end
399
401
 
400
- it 'should return false for an invalid number' do
402
+ it 'returns false for an invalid number' do
401
403
  is_expected.not_to be_plausible_number invalid_number, country_code: 'US'
402
404
  end
403
405
 
404
- it 'should return true for a normalizable number' do
406
+ it 'returns true for a normalizable number' do
405
407
  is_expected.to be_plausible_number normalizable_number, country_code: 'US'
406
408
  end
407
409
 
408
- it 'should return false for a valid number with the wrong country code' do
410
+ it 'returns false for a valid number with the wrong country code' do
409
411
  is_expected.not_to be_plausible_number normalizable_number, country_code: 'FR'
410
412
  end
411
413
 
412
- it 'should return true for a well formatted valid number' do
414
+ it 'returns true for a well formatted valid number' do
413
415
  is_expected.to be_plausible_number formatted_french_number_with_country_code, country_code: 'FR'
414
416
  end
415
417
 
416
- it 'should return false for an empty number' do
418
+ it 'returns false for an empty number' do
417
419
  is_expected.not_to be_plausible_number empty_number, country_code: 'US'
418
420
  end
419
421
 
420
- it 'should return false for a nil number' do
422
+ it 'returns false for a nil number' do
421
423
  is_expected.not_to be_plausible_number nil_number, country_code: 'US'
422
424
  end
423
425
 
424
- it 'should return false when no country code is supplied' do
426
+ it 'returns false when no country code is supplied' do
425
427
  is_expected.not_to be_plausible_number normalizable_number
426
428
  end
427
429
 
@@ -563,12 +565,12 @@ describe PhonyRails do
563
565
 
564
566
  describe 'using model#phony_normalized_method' do
565
567
  # Following examples have complete number (with country code!)
566
- it 'should return a normalized version of an attribute' do
568
+ it 'returns a normalized version of an attribute' do
567
569
  model = model_klass.new(phone_attribute: '+31-(0)10-1234123')
568
570
  expect(model.normalized_phone_attribute).to eql('+31101234123')
569
571
  end
570
572
 
571
- it 'should return a normalized version of a method' do
573
+ it 'returnsa normalized version of a method' do
572
574
  model = model_klass.new(phone_method: '+31-(0)10-1234123')
573
575
  expect(model.normalized_phone_method).to eql('+31101234123')
574
576
  end
@@ -641,6 +643,22 @@ describe PhonyRails do
641
643
  expect(model.phone_number).to eql(nil)
642
644
  end
643
645
 
646
+ it 'should nilify attribute when it is set to nil' do
647
+ model = ActiveRecordModel.create!(phone_number: '+31-(0)10-1234123')
648
+ model.phone_number = nil
649
+ expect(model).to be_valid
650
+ expect(model.save).to be(true)
651
+ expect(model.reload.phone_number).to eql(nil)
652
+ end
653
+
654
+ it 'should empty attribute when it is set to ""' do # Github issue #149
655
+ model = ActiveRecordModel.create!(phone_number: '+31-(0)10-1234123')
656
+ model.phone_number = ''
657
+ expect(model).to be_valid
658
+ expect(model.save).to be(true)
659
+ expect(model.reload.phone_number).to eql('')
660
+ end
661
+
644
662
  it 'should set a normalized version of an attribute using :as option' do
645
663
  model_klass.phony_normalize :phone_number, as: :phone_number_as_normalized
646
664
  model = model_klass.new(phone_number: '+31-(0)10-1234123')
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
2
3
  require 'spec_helper'
3
4
 
4
5
  #-----------------------------------------------------------------------------------------------------------------------
@@ -230,7 +231,7 @@ describe PhonyPlausibleValidator do
230
231
  I18n.with_locale(:fr) do
231
232
  @home.phone_number = INVALID_NUMBER
232
233
  @home.valid?
233
- expect(@home.errors.messages).to include(phone_number: ["est un numéro invalide"])
234
+ expect(@home.errors.messages).to include(phone_number: ['est un numéro invalide'])
234
235
  end
235
236
  end
236
237
 
@@ -238,7 +239,7 @@ describe PhonyPlausibleValidator do
238
239
  I18n.with_locale(:ja) do
239
240
  @home.phone_number = INVALID_NUMBER
240
241
  @home.valid?
241
- expect(@home.errors.messages).to include(phone_number: ["は正しい電話番号ではありません"])
242
+ expect(@home.errors.messages).to include(phone_number: ['は正しい電話番号ではありません'])
242
243
  end
243
244
  end
244
245
 
@@ -246,7 +247,7 @@ describe PhonyPlausibleValidator do
246
247
  I18n.with_locale(:km) do
247
248
  @home.phone_number = INVALID_NUMBER
248
249
  @home.valid?
249
- expect(@home.errors.messages).to include(phone_number: ["គឺជាលេខមិនត្រឹមត្រូវ"])
250
+ expect(@home.errors.messages).to include(phone_number: ['គឺជាលេខមិនត្រឹមត្រូវ'])
250
251
  end
251
252
  end
252
253
 
@@ -254,7 +255,7 @@ describe PhonyPlausibleValidator do
254
255
  I18n.with_locale(:uk) do
255
256
  @home.phone_number = INVALID_NUMBER
256
257
  @home.valid?
257
- expect(@home.errors.messages).to include(phone_number: ["є недійсним номером"])
258
+ expect(@home.errors.messages).to include(phone_number: ['є недійсним номером'])
258
259
  end
259
260
  end
260
261
 
@@ -262,7 +263,7 @@ describe PhonyPlausibleValidator do
262
263
  I18n.with_locale(:ru) do
263
264
  @home.phone_number = INVALID_NUMBER
264
265
  @home.valid?
265
- expect(@home.errors.messages).to include(phone_number: ["является недействительным номером"])
266
+ expect(@home.errors.messages).to include(phone_number: ['является недействительным номером'])
266
267
  end
267
268
  end
268
269
  end
@@ -323,7 +324,13 @@ describe ActiveModel::Validations::HelperMethods do
323
324
  @home = OptionalHelpfulHome.new
324
325
  end
325
326
 
327
+ it 'should validate an nil number' do
328
+ @home.phone_number = nil
329
+ expect(@home).to be_valid
330
+ end
331
+
326
332
  it 'should validate an empty number' do
333
+ @home.phone_number = ''
327
334
  expect(@home).to be_valid
328
335
  end
329
336
 
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'coveralls'
2
3
  Coveralls.wear!
3
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Hietbrink
@@ -14,56 +14,56 @@ dependencies:
14
14
  name: phony
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.15'
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
26
  version: '2.15'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
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
40
  version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mongoid
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  description: This Gem adds useful methods to your Rails app to validate, display and
@@ -74,11 +74,11 @@ executables: []
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - ".gitignore"
78
- - ".rspec"
79
- - ".rubocop.yml"
80
- - ".rubocop_todo.yml"
81
- - ".travis.yml"
77
+ - .gitignore
78
+ - .rspec
79
+ - .rubocop.yml
80
+ - .rubocop_todo.yml
81
+ - .travis.yml
82
82
  - CHANGELOG.md
83
83
  - Gemfile
84
84
  - Gemfile.lock
@@ -117,17 +117,17 @@ require_paths:
117
117
  - lib
118
118
  required_ruby_version: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - ">="
120
+ - - ! '>='
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - ">="
125
+ - - ! '>='
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
129
  rubyforge_project:
130
- rubygems_version: 2.5.1
130
+ rubygems_version: 2.4.5
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: This Gem adds useful methods to your Rails app to validate, display and save