unidom-geo-china 0.5.4 → 0.5.5

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: 064eb05711633c7d7c9b7782ada25a80d0d2e80e
4
- data.tar.gz: 79c2b92279fc00f87600702cca2eb913f9c9268e
3
+ metadata.gz: 3b46b75495fbc4f7d8cf1cf812e038874b112f03
4
+ data.tar.gz: 8b0544b4efa2abd64d7091e53e8a25281228ea4d
5
5
  SHA512:
6
- metadata.gz: e11f3f65a285c07bce3dbce22d0966f89fab403b5e04ddf9e55da06291dec65f6526b092c9a924e1a50f65d149d38aba125b700eef6a1edeed36e655290a29c8
7
- data.tar.gz: 395a06db555e8cc45887c737f3b98dc1b70df0b43b335d84e03bf07f6493ca3b40b14abaab3f1355a9145f22196050f3f323a196099fca3656c377a283fb999f
6
+ metadata.gz: 3d6b905e7fccc890adee8db7f987e685d09f543251a6ddd593e239e2d76d4320f3463b865263fd13301fba8208b8566349dc64ff43558f3d9afe93959e127700
7
+ data.tar.gz: da667199bf936505aae2af7642b4f63c0526b1e62d383f50ad1eb0ee629662210e2a5b44fe8aa03b84a8249b1796d89f47916ddf8487a9d0f1e54062255b6441
@@ -40,34 +40,10 @@ describe Unidom::Geo::China::Region, type: :model do
40
40
  { numeric_code: 1111111 } => 1,
41
41
  { numeric_code: '11111A' } => 1
42
42
 
43
- it_behaves_like 'validates', model_attributes, :alphabetic_code,
44
- { } => 0,
45
- { alphabetic_code: nil } => 0,
46
- { alphabetic_code: '' } => 0,
47
- { alphabetic_code: '1' } => 1,
48
- { alphabetic_code: '11' } => 0,
49
- { alphabetic_code: 'AA' } => 0,
50
- { alphabetic_code: '111' } => 0,
51
- { alphabetic_code: 'AAA' } => 0,
52
- { alphabetic_code: '1111' } => 1,
53
- { alphabetic_code: 'AAAA' } => 1
54
-
55
- it_behaves_like 'validates', model_attributes, :name,
56
- { } => 0,
57
- { name: nil } => 2,
58
- { name: '' } => 2,
59
- { name: '1' } => 0,
60
- { name: 'A' } => 0,
61
- { name: '11' } => 0,
62
- { name: 'AA' } => 0,
63
- { name: '111' } => 0,
64
- { name: 'AAA' } => 0,
65
- { name: '1'*(name_max_length-1) } => 0,
66
- { name: 'A'*(name_max_length-1) } => 0,
67
- { name: '1'*name_max_length } => 0,
68
- { name: 'A'*name_max_length } => 0,
69
- { name: '1'*(name_max_length+1) } => 1,
70
- { name: 'A'*(name_max_length+1) } => 1
43
+ it_behaves_like 'validates text', model_attributes, :alphabetic_code,
44
+ length: 2..described_class.columns_hash['alphabetic_code'].limit
45
+ it_behaves_like 'validates text', model_attributes, :name,
46
+ length: 1..described_class.columns_hash['name'].limit
71
47
 
72
48
  town_1_attributes = {
73
49
  numeric_code: '1'*9,
@@ -14,8 +14,6 @@ describe Unidom::Geo::China::Town, type: :model do
14
14
  name: 'Some Town'
15
15
  }
16
16
 
17
- name_max_length = described_class.columns_hash['name'].limit
18
-
19
17
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
20
18
 
21
19
  it_behaves_like 'validates', model_attributes, :numeric_code,
@@ -37,21 +35,8 @@ describe Unidom::Geo::China::Town, type: :model do
37
35
  { numeric_code: '111111.11' } => 1,
38
36
  { numeric_code: 111111.11 } => 1
39
37
 
40
- it_behaves_like 'validates', model_attributes, :name,
41
- { } => 0,
42
- { name: nil } => 2,
43
- { name: '' } => 2,
44
- { name: '1' } => 1,
45
- { name: '11' } => 0,
46
- { name: 'AA' } => 0,
47
- { name: '111' } => 0,
48
- { name: 'AAA' } => 0,
49
- { name: '1'*(name_max_length-1) } => 0,
50
- { name: 'A'*(name_max_length-1) } => 0,
51
- { name: '1'*name_max_length } => 0,
52
- { name: 'A'*name_max_length } => 0,
53
- { name: '1'*(name_max_length+1) } => 1,
54
- { name: 'A'*(name_max_length+1) } => 1
38
+ it_behaves_like 'validates text', model_attributes, :name,
39
+ length: 2..described_class.columns_hash['name'].limit
55
40
 
56
41
  region_attributes = {
57
42
  scheme_id: SecureRandom.uuid,
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Geo
3
3
  module China
4
- VERSION = '0.5.4'.freeze
4
+ VERSION = '0.5.5'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-geo-china
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-geo