unidom-certificate-china 1.5.2 → 1.5.3

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: 7d7c9110d9582536eebe5bcca2fc87595c751d7b
4
- data.tar.gz: 1207af8a55229f248d962952b26a12f69bbb5118
3
+ metadata.gz: 7b8872085abe278128286948eba3f331ecd586e2
4
+ data.tar.gz: ba4e4654f0f20911a6d932c4476147a8ce15c312
5
5
  SHA512:
6
- metadata.gz: ad1f70bcc72febbc3ec67354377f9703d20406185ce5f28c0f0c3be6d4dcbd6c4f3bfa0b2abe2dcb8227bc5446f45b72c3759476304962e458b181fd4387608b
7
- data.tar.gz: 7749431ae2b71eb3411c8a49864486607fae8169da7f031c8b32d778aa6a194cde0ead51735c21bcdead134ad867c92e7237f63dd145f1bc3b6ebbfff106c1f9
6
+ metadata.gz: cddbaecb2ccd4f93b2da80758fc8310167bf011b7ae1cf811ee94745fe595e3a52145d65dfb6a2a2ca7b3c1e5deeb4b924f27e0a98a851143c9d983463bb3eb9
7
+ data.tar.gz: baa1c2bd41b917302c8fd5cc8ae923a11c72fc24bd791c6891398e8f7f5b83b1100e32c0b65d6c84c286f8ceb0c05f018191bab2aabf0bfb67d5268e8d436535
@@ -1,4 +1,2 @@
1
- module China
2
- module ApplicationHelper
3
- end
1
+ module Unidom::Certificate::China::ApplicationHelper
4
2
  end
@@ -19,8 +19,45 @@ describe Unidom::Certificate::China::BusinessLicense, type: :model do
19
19
  validity_thru_date: Date.current+10.years
20
20
  }
21
21
 
22
+ registration_number_max_length = described_class.columns_hash['registration_number'].limit
23
+ unified_social_credit_identifier_max_length = described_class.columns_hash['unified_social_credit_identifier'].limit
24
+
22
25
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
23
26
 
27
+ it_behaves_like 'validates', model_attributes, :registration_number,
28
+ { } => 0,
29
+ { registration_number: nil } => 0,
30
+ { registration_number: '' } => 0,
31
+ { registration_number: '1' } => 2,
32
+ { registration_number: 'A' } => 3,
33
+ { registration_number: '11' } => 2,
34
+ { registration_number: 'AA' } => 3,
35
+ { registration_number: '111' } => 2,
36
+ { registration_number: 'AAA' } => 3,
37
+ { registration_number: '1'*(registration_number_max_length-1) } => 2,
38
+ { registration_number: 'A'*(registration_number_max_length-1) } => 3,
39
+ { registration_number: '1'*registration_number_max_length } => 0,
40
+ { registration_number: 'A'*registration_number_max_length } => 2,
41
+ { registration_number: '1'*(registration_number_max_length+1) } => 2,
42
+ { registration_number: 'A'*(registration_number_max_length+1) } => 3
43
+
44
+ it_behaves_like 'validates', model_attributes, :unified_social_credit_identifier,
45
+ { } => 0,
46
+ { unified_social_credit_identifier: nil } => 0,
47
+ { unified_social_credit_identifier: '' } => 0,
48
+ { unified_social_credit_identifier: '1' } => 1,
49
+ { unified_social_credit_identifier: 'A' } => 1,
50
+ { unified_social_credit_identifier: '11' } => 1,
51
+ { unified_social_credit_identifier: 'AA' } => 1,
52
+ { unified_social_credit_identifier: '111' } => 1,
53
+ { unified_social_credit_identifier: 'AAA' } => 1,
54
+ { unified_social_credit_identifier: '1'*(unified_social_credit_identifier_max_length-1) } => 1,
55
+ { unified_social_credit_identifier: 'A'*(unified_social_credit_identifier_max_length-1) } => 1,
56
+ { unified_social_credit_identifier: '1'*unified_social_credit_identifier_max_length } => 0,
57
+ { unified_social_credit_identifier: 'A'*unified_social_credit_identifier_max_length } => 0,
58
+ { unified_social_credit_identifier: '1'*(unified_social_credit_identifier_max_length+1) } => 1,
59
+ { unified_social_credit_identifier: 'A'*(unified_social_credit_identifier_max_length+1) } => 1
60
+
24
61
  end
25
62
 
26
63
  end
@@ -20,8 +20,27 @@ describe Unidom::Certificate::China::IdentityCard, type: :model do
20
20
  validity_thru_date: Date.current+10.years
21
21
  }
22
22
 
23
+ identification_number_max_length = described_class.columns_hash['identification_number'].limit
24
+
23
25
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
24
26
 
27
+ it_behaves_like 'validates', model_attributes, :identification_number,
28
+ { } => 0,
29
+ { identification_number: nil } => 3,
30
+ { identification_number: '' } => 3,
31
+ { identification_number: '1' } => 2,
32
+ { identification_number: 'A' } => 2,
33
+ { identification_number: '11' } => 2,
34
+ { identification_number: 'AA' } => 2,
35
+ { identification_number: '111' } => 2,
36
+ { identification_number: 'AAA' } => 2,
37
+ { identification_number: '1'*(identification_number_max_length-1) } => 2,
38
+ { identification_number: 'A'*(identification_number_max_length-1) } => 2,
39
+ { identification_number: '1'*identification_number_max_length } => 0,
40
+ { identification_number: 'A'*identification_number_max_length } => 1,
41
+ { identification_number: '1'*(identification_number_max_length+1) } => 2,
42
+ { identification_number: 'A'*(identification_number_max_length+1) } => 2
43
+
25
44
  end
26
45
 
27
46
  end
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Certificate
3
3
  module China
4
- VERSION = '1.5.2'.freeze
4
+ VERSION = '1.5.3'.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-certificate-china
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
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-02-16 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-certificate