phonie 3.2.0 → 3.2.1

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: 63430f9a7ddd93501a47912cd0633659a75f4ba4
4
- data.tar.gz: 3af1b6b48b273050142341f718831eb025eb572a
3
+ metadata.gz: f8f31f3a293d0b81f63fb726f5771c8ff9ce4639
4
+ data.tar.gz: f330f1347b5899e0f2f05b6cd7c84cae16c58ac9
5
5
  SHA512:
6
- metadata.gz: 2a25a8c40fcf39d2f6133863349f61d431bb333ad893627776fd9cf1caf6a9444bb79400059593c5adbc8075428ff8c65d5524ff82f97ffca0bb911f96c1099e
7
- data.tar.gz: 9109087504ee399cda986035e77d9504253301b287d73687dc273b164562ff3ff52824bffe4baf419ba3950ca3bbe04d30c4ea6781cf598d42c3c651269d5470
6
+ metadata.gz: a835b49507ffcf55327637e76de049563007886880b8ab231863361d5da6d6bf555d824236697d21e93c0331e3651350321c905e5fc5fc5d2ec7196fcecb7883
7
+ data.tar.gz: a7f1a233c5a29fd1a2fbc89b24944e5c8e8a7be5c3eaa09c487bb09aa67b5c984a69b484677a2ee9ba8374171ccb6e97c7ec822f9eb86eebbeb8ff3f4895f636
data/Changelog.md CHANGED
@@ -1,3 +1,9 @@
1
+ 3.2.1
2
+ =====
3
+
4
+ * Adds support for Uganda (Thanks @dramalho)
5
+ * Adds tests for new mobile validator
6
+
1
7
  3.2.0
2
8
  =====
3
9
 
data/Readme.rdoc CHANGED
@@ -189,6 +189,7 @@ Currently tested on:
189
189
  [TT] Trinidad and Tobago
190
190
  [TW] Taiwan
191
191
  [UA] Ukraine
192
+ [UG] Uganda
192
193
  [US] United States
193
194
  [UY] Uruguay
194
195
  [VN] Vietnam
@@ -352,6 +352,10 @@
352
352
  :char_2_code: '0'
353
353
  :iso_3166_code: UG
354
354
  :name: Uganda
355
+ :area_code: '4\d{1,2}|7\d{1}|9\d{2}'
356
+ :number_format: '\d{9}'
357
+ :local_number_format: '\d{6,7}'
358
+ :mobile_format: '(70|71|75|77|78|90)\d{7}'
355
359
  :international_dialing_prefix: '00'
356
360
  -
357
361
  :country_code: '228'
@@ -1,3 +1,3 @@
1
1
  module Phonie
2
- VERSION = '3.2.0'
2
+ VERSION = '3.2.1'
3
3
  end
@@ -0,0 +1,13 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
+
3
+ ## Uganda
4
+ class UGTest < Phonie::TestCase
5
+ def test_local
6
+ parse_test('+256423779423', '256', '423', '779423', 'Uganda', false)
7
+ end
8
+
9
+ def test_mobile
10
+ parse_test('+256700167639', '256', '70', '0167639', 'Uganda', true)
11
+ end
12
+
13
+ end
@@ -2,6 +2,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
2
  require 'active_model'
3
3
  require 'phonie/railties/validator'
4
4
 
5
+ I18n.enforce_available_locales = false
6
+
5
7
  class SomeModel < Struct.new(:phone_number)
6
8
  include ActiveModel::Validations
7
9
  validates :phone_number, phone: true
@@ -12,6 +14,11 @@ class SomeOtherModel < Struct.new(:phone_number)
12
14
  validates :phone_number, phone: true, allow_blank: true
13
15
  end
14
16
 
17
+ class SomeMobileModel < Struct.new(:mobile_number)
18
+ include ActiveModel::Validations
19
+ validates :mobile_number, mobile_phone: true, allow_blank: true
20
+ end
21
+
15
22
  class PhoneValidatorTest < Phonie::TestCase
16
23
  def test_blank_phone
17
24
  assert SomeModel.new(nil).invalid?
@@ -36,4 +43,12 @@ class PhoneValidatorTest < Phonie::TestCase
36
43
 
37
44
  assert !model.errors[:phone_number].empty?
38
45
  end
46
+
47
+ def test_mobile_validator
48
+ valid = SomeMobileModel.new('+886952475345')
49
+ invalid = SomeMobileModel.new('+886423194678')
50
+
51
+ assert valid.valid?
52
+ assert invalid.invalid?
53
+ end
39
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonie
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomislav Car
@@ -206,6 +206,7 @@ files:
206
206
  - test/countries/tt_test.rb
207
207
  - test/countries/tw_test.rb
208
208
  - test/countries/ua_test.rb
209
+ - test/countries/ug_test.rb
209
210
  - test/countries/us_test.rb
210
211
  - test/countries/uy_test.rb
211
212
  - test/countries/vn_test.rb
@@ -346,6 +347,7 @@ test_files:
346
347
  - test/countries/tt_test.rb
347
348
  - test/countries/tw_test.rb
348
349
  - test/countries/ua_test.rb
350
+ - test/countries/ug_test.rb
349
351
  - test/countries/us_test.rb
350
352
  - test/countries/uy_test.rb
351
353
  - test/countries/vn_test.rb