phony_rails 0.12.3 → 0.12.4

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
2
  SHA1:
3
- metadata.gz: 2355478441210acbafebb74435193835a27a3b6f
4
- data.tar.gz: ad9a7043b6fdda221b8283ed9f1f6ac359f6ac52
3
+ metadata.gz: 580be97d53e4e08977013b8033af91d391dea1b2
4
+ data.tar.gz: 86fbc558bf484ab8f60a63eaa197d9dbdea887d8
5
5
  SHA512:
6
- metadata.gz: be3de636fac977f1b2f0cb1f9c3179aa9a076609b523e8a8e4bf43550057d9edb4d4651d2c03fe9fdcec479730bafc54b2d766b10465060950b129ee4f26b526
7
- data.tar.gz: aacfe26b61f9a7b87c31ff7d0f7eded00c0fffa5bad37bd04f3e80b3cade8cfbf2335ff1a6d60d06050c3a5c140471df3a6203b2008af1bf196d510ac84c2cb7
6
+ metadata.gz: 80b6bfc73635665590541c82cf4653016cc7b853faea145889be9008ec74aa2e522ac5f2bf9e2aea29015801666f1c09f0d986dcc01490b7975dba30ee6a2df2
7
+ data.tar.gz: 7312b87a901d27a09e923e02a916277f1da3af13e180bc08a701a6480521141f1331067ec92e8f16db449739046676c6202d77610b448510969f85c080a18b40
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phony_rails (0.12.3)
4
+ phony_rails (0.12.4)
5
5
  activesupport (>= 3.0)
6
6
  countries (~> 0.8, >= 0.8.2)
7
7
  phony (~> 2.12)
data/lib/phony_rails.rb CHANGED
@@ -22,7 +22,7 @@ module PhonyRails
22
22
  def self.normalize_number(number, options = {})
23
23
  return if number.nil?
24
24
  number = number.clone # Just to be sure, we don't want to change the original.
25
- number.gsub!(/[^\d\+]/, '') # Strips weird stuff from the number
25
+ number.gsub!(/[^\(\)\d\+]/, '') # Strips weird stuff from the number
26
26
  return if number.blank?
27
27
  if _country_number = options[:country_number] || country_number_for(options[:country_code])
28
28
  options[:add_plus] = true if options[:add_plus].nil?
@@ -1,3 +1,3 @@
1
1
  module PhonyRails
2
- VERSION = "0.12.3"
2
+ VERSION = "0.12.4"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  # Uses the Phony.plausible method to validate an attribute.
2
2
  # Usage:
3
3
  # validate :phone_number, :phony_plausible => true
4
+ require 'active_record'
4
5
  class PhonyPlausibleValidator < ActiveModel::EachValidator
5
6
 
6
7
  # Validates a String using Phony.plausible? method.
@@ -108,6 +108,12 @@ describe PhonyRails do
108
108
  PhonyRails.normalize_number('2318725305', default_country_code: 'US').should eq('+12318725305')
109
109
  PhonyRails.normalize_number('+2318725305', default_country_code: 'US').should eq('+2318725305')
110
110
  end
111
+
112
+ it "should pass Github issue #89" do
113
+ number = '+33 (0)6 87 36 18 75'
114
+ Phony.plausible?(number).should be_true
115
+ PhonyRails.normalize_number(number, country_code: 'FR').should eq('+33687361875')
116
+ end
111
117
  end
112
118
 
113
119
  it "should not change original String" do
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.12.3
4
+ version: 0.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joost Hietbrink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-05 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phony