unidom-dictionary 0.3 → 0.3.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: 0b3c5191d9ca3ae4260874183afde8837dab4dd6
4
- data.tar.gz: 33f15d9c71a4b2c9a7545d6bd66af05b55b2e5e0
3
+ metadata.gz: 3ea3270b618df8759507840edecbb4166b54250f
4
+ data.tar.gz: 3556c8b474b43ac9301669524bca12341ab7157b
5
5
  SHA512:
6
- metadata.gz: 4341a07a44484a355b52843286b00bae22df50722afa23e4529bb03e7798545683f5af3dc982ad1886a9a9a276696e7ef68b34dee64a6f05124f3401d6d0261a
7
- data.tar.gz: c9788483de660ffe4c304e52bf0039ac553a414d5d71cdf168be3075315b25eda511ec3504575e3c1d8fa6b36c02116697329b99527218f23cebad9b7469469d
6
+ metadata.gz: 9a1583405e494e835dd70406e33890767237f81abc0dccfed0f88b4b554af1a9a3432e1b30f96a0374dbdb8d3ddc2a621d9b6b8d5e58a9c891db538656558581
7
+ data.tar.gz: bcb2ff6d5050b7a58f652a631e546336b47418327e188a3f7dfced5cbeae47baf05f9180183d1670fca49495540eac1fb42a4b69ef64e1a4cb20f5df1388d469
@@ -7,7 +7,6 @@ class Unidom::Dictionary::DictionaryItem < Unidom::Dictionary::ApplicationRecord
7
7
 
8
8
  include Unidom::Common::Concerns::ModelExtension
9
9
 
10
- validates :code, allow_blank: true, length: { in: 1..self.columns_hash['code'].limit }
11
- validates :value, presence: true, length: { in: 2..self.columns_hash['value'].limit }
10
+ validates :value, presence: true, length: { in: 2..self.columns_hash['value'].limit }
12
11
 
13
12
  end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Dictionary::DictionaryItem'
@@ -16,6 +16,38 @@ describe Unidom::Dictionary::DictionaryItem, type: :model do
16
16
 
17
17
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
18
18
 
19
+ it_behaves_like 'validates', model_attributes, :dictionary_code,
20
+ { } => 0,
21
+ { dictionary_code: nil } => 2,
22
+ { dictionary_code: '' } => 2,
23
+ { dictionary_code: 'A' } => 1,
24
+ { dictionary_code: 'AA' } => 1,
25
+ { dictionary_code: 'AAA' } => 1,
26
+ { dictionary_code: 'AAAA' } => 0,
27
+ { dictionary_code: 'AAAAA' } => 1
28
+
29
+ it_behaves_like 'validates', model_attributes, :code,
30
+ { } => 0,
31
+ { code: nil } => 0,
32
+ { code: '' } => 0,
33
+ { code: 'A' } => 0,
34
+ { code: 'AA' } => 0,
35
+ { code: 'AAA' } => 0,
36
+ { code: 'A'*63 } => 0,
37
+ { code: 'A'*64 } => 0,
38
+ { code: 'A'*65 } => 1
39
+
40
+ it_behaves_like 'validates', model_attributes, :value,
41
+ { } => 0,
42
+ { value: nil } => 2,
43
+ { value: '' } => 2,
44
+ { value: 'A' } => 1,
45
+ { value: 'AA' } => 0,
46
+ { value: 'AAA' } => 0,
47
+ { value: 'A'*199 } => 0,
48
+ { value: 'A'*200 } => 0,
49
+ { value: 'A'*201 } => 1
50
+
19
51
  end
20
52
 
21
53
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Dictionary
3
- VERSION = '0.3'.freeze
3
+ VERSION = '0.3.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-dictionary
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.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-01-30 00:00:00.000000000 Z
11
+ date: 2017-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common