phony_rails 0.14.12 → 0.14.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f5bc5fd8efabff8b0607fe060f2d27b11ddbd948
4
- data.tar.gz: 68add4fb0fc07c768ecafdd390e1ce471940eb07
2
+ SHA256:
3
+ metadata.gz: c65b83fb1c77dccdf0b125fa2195b997067bc06efa4fff2284ab3542e643a7b3
4
+ data.tar.gz: '09e7d37472c4c0ccfa050f381506c11f2ec5b939c75199c26e2529b531ccfa90'
5
5
  SHA512:
6
- metadata.gz: d61d5e02e7e61a8b15088a09d1ae8cc5db8ce5eb38c388ff2845e27a508a2fde4e12e6780042cec5832992610d54908456423a639671c0a6eb128cb45f24a1ce
7
- data.tar.gz: 3e61051454973a4ca74a0e863a500f53dfd49bebf26d7e19d311332d8fc701a20dfe55a2ef035cb1184811fcd14809225629023b15e525dce61167a18637456c
6
+ metadata.gz: 5b35b337390b7c90d8c1a0d9ef972205089f56a04e1d4e51c59ded39acc7bfee6568fbf7d06e7a603d9091e58bfe0ef8f12f974b2170d55b704bc9d375a23846
7
+ data.tar.gz: a2cb0e49ce1039adb889b4e080cb5418a0c3ea88bd129edc991028e5aa0b5c6620c7fa4ab0a82316655b00d31d06eda7e9a5eb1cd824e0dc422f0e95506ae272
@@ -1,5 +1,18 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.14.12](https://github.com/joost/phony_rails/tree/v0.14.12) (2019-06-21)
4
+ [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.11...v0.14.12)
5
+
6
+ **Closed issues:**
7
+
8
+ - Some German numbers not passing plausible\_numbers? without country\_code [\#193](https://github.com/joost/phony_rails/issues/193)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Upgrade Ruby versions and Relax dependancies [\#192](https://github.com/joost/phony_rails/pull/192) ([berkos](https://github.com/berkos))
13
+ - Add possibility to return original phone number when is not valid [\#190](https://github.com/joost/phony_rails/pull/190) ([synion](https://github.com/synion))
14
+ - Add UK country\_code. [\#189](https://github.com/joost/phony_rails/pull/189) ([ayghor](https://github.com/ayghor))
15
+
3
16
  ## [v0.14.11](https://github.com/joost/phony_rails/tree/v0.14.11) (2018-10-11)
4
17
  [Full Changelog](https://github.com/joost/phony_rails/compare/v0.14.10...v0.14.11)
5
18
 
@@ -172,7 +185,7 @@
172
185
  **Merged pull requests:**
173
186
 
174
187
  - Update readme [\#117](https://github.com/joost/phony_rails/pull/117) ([toydestroyer](https://github.com/toydestroyer))
175
- - Add uk, ru error message translations [\#114](https://github.com/joost/phony_rails/pull/114) ([sanavy](https://github.com/sanavy))
188
+ - Add uk, ru error message translations [\#114](https://github.com/joost/phony_rails/pull/114) ([shhavel](https://github.com/shhavel))
176
189
  - Update phony\_rails.gemspec [\#112](https://github.com/joost/phony_rails/pull/112) ([Agsiegert](https://github.com/Agsiegert))
177
190
  - Don't re-parse country codes YAML file every time it's needed. [\#111](https://github.com/joost/phony_rails/pull/111) ([jcoleman](https://github.com/jcoleman))
178
191
  - Replace countries dependency with YAML file [\#109](https://github.com/joost/phony_rails/pull/109) ([monfresh](https://github.com/monfresh))
@@ -176,8 +176,9 @@ module PhonyRails
176
176
  end
177
177
 
178
178
  def cache_original_attribute(current_instance, attribute)
179
- current_instance.define_singleton_method("#{attribute}_original=") { |value| @original = value }
180
- current_instance.define_singleton_method("#{attribute}_original") { @original }
179
+ attribute_name = "#{attribute}_original"
180
+ current_instance.define_singleton_method("#{attribute_name}=") { |value| instance_variable_set("@#{attribute_name}", value) }
181
+ current_instance.define_singleton_method(attribute_name) { instance_variable_get("@#{attribute_name}") }
181
182
  current_instance.public_send("#{attribute}_original=", current_instance.public_send(attribute.to_s))
182
183
  end
183
184
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhonyRails
4
- VERSION = '0.14.12'
4
+ VERSION = '0.14.13'
5
5
  end
@@ -172,9 +172,11 @@ class MessageOptionSameAsModelMethod < HelpfulHome
172
172
  end
173
173
  #--------------------
174
174
  class NormalizabledPhoneHome < ActiveRecord::Base
175
- attr_accessor :phone_number, :country_code
175
+ attr_accessor :phone_number, :phone_number2, :country_code
176
176
  validates_plausible_phone :phone_number
177
+ validates_plausible_phone :phone_number2
177
178
  phony_normalize :phone_number, country_code: 'PL', normalize_when_valid: true
179
+ phony_normalize :phone_number2, country_code: 'PL', normalize_when_valid: true
178
180
  end
179
181
 
180
182
  #-----------------------------------------------------------------------------------------------------------------------
@@ -667,6 +669,23 @@ describe ActiveModel::Validations::HelperMethods do
667
669
  expect(@home).to be_valid
668
670
  expect(@home.phone_number).to eql('+48799449595')
669
671
  end
672
+
673
+ it 'does not normalize code after validation with multiple attributes' do
674
+ @home = NormalizabledPhoneHome.new
675
+ @home.phone_number = '+44 799 449 595'
676
+ @home.phone_number2 = '+44 222 111 333'
677
+ @home.country_code = 'PL'
678
+
679
+ expect(@home).to_not be_valid
680
+ expect(@home.phone_number).to eql('+44 799 449 595')
681
+ expect(@home.phone_number2).to eql('+44 222 111 333')
682
+
683
+ @home.phone_number = '+48 799 449 595'
684
+ @home.phone_number2 = '+48 222 111 333'
685
+ expect(@home).to be_valid
686
+ expect(@home.phone_number).to eql('+48799449595')
687
+ expect(@home.phone_number2).to eql('+48222111333')
688
+ end
670
689
  end
671
690
  end
672
691
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.12
4
+ version: 0.14.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Hietbrink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-21 00:00:00.000000000 Z
11
+ date: 2019-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
- rubygems_version: 2.5.1
146
+ rubygems_version: 2.7.7
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: This Gem adds useful methods to your Rails app to validate, display and save