unidom-category 1.6.5 → 1.6.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4fe54df3292fb56eb4eb3a53e3ea8dbf54be27a
4
- data.tar.gz: c1e51b4ac7559bda765f160feadf2859f6e446ef
3
+ metadata.gz: 288af343565aecbe82a1a407b826dbca5bb06479
4
+ data.tar.gz: 8f4ad8b60a1413f0b4208fa45a4d6d5b258e5bd3
5
5
  SHA512:
6
- metadata.gz: 8ab0717de01b7e3bfc7bbb5e4ec874dd6ac87433d66580f606667c4c2c7c659bc386ef7b00bb309ee72044bd5a227eac0785914ba95c569068766e927d869084
7
- data.tar.gz: 4fb1666ffe7548bc2adae07132f70db1d383a5dae68250e1bd6c0dc67cdaaae2050f7b19cefcb81af8c4e34851e057dcc7a0fa1c9b60264745ced260f8fda5de
6
+ metadata.gz: 3e4d56692789e12a9fee0e8ee3584c3115adbcd54bd8886454ab8bb9d0d6bc677bc312a59cde45c364d150ba8bb4bb89468c2e57b46ac63a15dbc5876562d75b
7
+ data.tar.gz: 296807f713273f5562411ed6981def77baf38b53162f59adf7ab8d0e321d084df2845197f93128a1ad1e528f0cd57004c57819ac85ba7bb8a08121adc6fd0121
@@ -14,26 +14,10 @@ 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
-
19
17
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
20
18
 
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
19
+ it_behaves_like 'validates text', model_attributes, :name,
20
+ length: 2..described_class.columns_hash['name'].limit
37
21
 
38
22
  category_1_attributes = {
39
23
  code: 'XC1',
@@ -15,44 +15,12 @@ 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
-
21
18
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
22
19
 
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
20
+ it_behaves_like 'validates text', model_attributes, :name,
21
+ length: 2..described_class.columns_hash['name'].limit
22
+ it_behaves_like 'validates text', model_attributes, :abbreviation,
23
+ length: 2..described_class.columns_hash['abbreviation'].limit
56
24
 
57
25
  scheme_attributes = {
58
26
  owner_id: SecureRandom.uuid,
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Category
3
- VERSION = '1.6.5'.freeze
3
+ VERSION = '1.6.6'.freeze
4
4
  end
5
5
  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: 1.6.5
4
+ version: 1.6.6
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-22 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common