phonie 3.2.0 → 3.2.1
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 +4 -4
- data/Changelog.md +6 -0
- data/Readme.rdoc +1 -0
- data/lib/phonie/data/phone_countries.yml +4 -0
- data/lib/phonie/version.rb +1 -1
- data/test/countries/ug_test.rb +13 -0
- data/test/railties/validator_test.rb +15 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8f31f3a293d0b81f63fb726f5771c8ff9ce4639
|
4
|
+
data.tar.gz: f330f1347b5899e0f2f05b6cd7c84cae16c58ac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a835b49507ffcf55327637e76de049563007886880b8ab231863361d5da6d6bf555d824236697d21e93c0331e3651350321c905e5fc5fc5d2ec7196fcecb7883
|
7
|
+
data.tar.gz: a7f1a233c5a29fd1a2fbc89b24944e5c8e8a7be5c3eaa09c487bb09aa67b5c984a69b484677a2ee9ba8374171ccb6e97c7ec822f9eb86eebbeb8ff3f4895f636
|
data/Changelog.md
CHANGED
data/Readme.rdoc
CHANGED
@@ -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'
|
data/lib/phonie/version.rb
CHANGED
@@ -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.
|
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
|