unidom-category 1.6 → 1.6.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cb0961fd5b681321fcc47a73c980bb3421c5fed
|
4
|
+
data.tar.gz: 0aa1b2ab6a21fb78db6599fc8210a2510abc2453
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c56b220c9e4c9413c4c531762535d9f24f90901c068b12bb6e2c69a01ae6774070ad3df8b7bf8c7a1f56bb10b1dd8152ec5dbf6d89e18c775c96123dce91653f
|
7
|
+
data.tar.gz: ac6473f67e21254b474de0113a23864de1a79246ed610bd15961b288772db8df8623ccd6c47dcdb1258a5c3d29b3cdb471ba928dda6216b598a16bf419c1d2b8
|
@@ -14,8 +14,27 @@ describe Unidom::Category::CategoryScheme, type: :model do
|
|
14
14
|
name: 'Scheme #1'
|
15
15
|
}
|
16
16
|
|
17
|
+
name_max_length = described_class.columns_hash['name'].limit
|
18
|
+
|
17
19
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
18
20
|
|
21
|
+
it_behaves_like 'validates', model_attributes, :name,
|
22
|
+
{ } => 0,
|
23
|
+
{ name: nil } => 2,
|
24
|
+
{ name: '' } => 2,
|
25
|
+
{ name: '1' } => 1,
|
26
|
+
{ name: 'A' } => 1,
|
27
|
+
{ name: '11' } => 0,
|
28
|
+
{ name: 'AA' } => 0,
|
29
|
+
{ name: '111' } => 0,
|
30
|
+
{ name: 'AAA' } => 0,
|
31
|
+
{ name: '1'*(name_max_length-1) } => 0,
|
32
|
+
{ name: 'A'*(name_max_length-1) } => 0,
|
33
|
+
{ name: '1'*name_max_length } => 0,
|
34
|
+
{ name: 'A'*name_max_length } => 0,
|
35
|
+
{ name: '1'*(name_max_length+1) } => 1,
|
36
|
+
{ name: 'A'*(name_max_length+1) } => 1
|
37
|
+
|
19
38
|
end
|
20
39
|
|
21
40
|
end
|
@@ -15,8 +15,45 @@ describe Unidom::Category::Category, type: :model do
|
|
15
15
|
abbreviation: 'TopCat'
|
16
16
|
}
|
17
17
|
|
18
|
+
name_max_length = described_class.columns_hash['name'].limit
|
19
|
+
abbreviation_max_length = described_class.columns_hash['abbreviation'].limit
|
20
|
+
|
18
21
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
19
22
|
|
23
|
+
it_behaves_like 'validates', model_attributes, :name,
|
24
|
+
{ } => 0,
|
25
|
+
{ name: nil } => 2,
|
26
|
+
{ name: '' } => 2,
|
27
|
+
{ name: '1' } => 1,
|
28
|
+
{ name: 'A' } => 1,
|
29
|
+
{ name: '11' } => 0,
|
30
|
+
{ name: 'AA' } => 0,
|
31
|
+
{ name: '111' } => 0,
|
32
|
+
{ name: 'AAA' } => 0,
|
33
|
+
{ name: '1'*(name_max_length-1) } => 0,
|
34
|
+
{ name: 'A'*(name_max_length-1) } => 0,
|
35
|
+
{ name: '1'*name_max_length } => 0,
|
36
|
+
{ name: 'A'*name_max_length } => 0,
|
37
|
+
{ name: '1'*(name_max_length+1) } => 1,
|
38
|
+
{ name: 'A'*(name_max_length+1) } => 1
|
39
|
+
|
40
|
+
it_behaves_like 'validates', model_attributes, :abbreviation,
|
41
|
+
{ } => 0,
|
42
|
+
{ abbreviation: nil } => 0,
|
43
|
+
{ abbreviation: '' } => 0,
|
44
|
+
{ abbreviation: '1' } => 1,
|
45
|
+
{ abbreviation: 'A' } => 1,
|
46
|
+
{ abbreviation: '11' } => 0,
|
47
|
+
{ abbreviation: 'AA' } => 0,
|
48
|
+
{ abbreviation: '111' } => 0,
|
49
|
+
{ abbreviation: 'AAA' } => 0,
|
50
|
+
{ abbreviation: '1'*(abbreviation_max_length-1) } => 0,
|
51
|
+
{ abbreviation: 'A'*(abbreviation_max_length-1) } => 0,
|
52
|
+
{ abbreviation: '1'*abbreviation_max_length } => 0,
|
53
|
+
{ abbreviation: 'A'*abbreviation_max_length } => 0,
|
54
|
+
{ abbreviation: '1'*(abbreviation_max_length+1) } => 1,
|
55
|
+
{ abbreviation: 'A'*(abbreviation_max_length+1) } => 1
|
56
|
+
|
20
57
|
end
|
21
58
|
|
22
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-category
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.6.1
|
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-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|