lib/rspec/models/unidom/dictionary/dictionary_item_spec.rb in unidom-dictionary-0.3.1 vs lib/rspec/models/unidom/dictionary/dictionary_item_spec.rb in unidom-dictionary-0.3.2

- old
+ new

@@ -14,40 +14,17 @@ value: 'other' } it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes - it_behaves_like 'validates', model_attributes, :dictionary_code, - { } => 0, - { dictionary_code: nil } => 2, - { dictionary_code: '' } => 2, - { dictionary_code: 'A' } => 1, - { dictionary_code: 'AA' } => 1, - { dictionary_code: 'AAA' } => 1, - { dictionary_code: 'AAAA' } => 0, - { dictionary_code: 'AAAAA' } => 1 + it_behaves_like 'validates text', model_attributes, :dictionary_code, + length: described_class.columns_hash['dictionary_code'].limit..described_class.columns_hash['dictionary_code'].limit - it_behaves_like 'validates', model_attributes, :code, - { } => 0, - { code: nil } => 0, - { code: '' } => 0, - { code: 'A' } => 0, - { code: 'AA' } => 0, - { code: 'AAA' } => 0, - { code: 'A'*63 } => 0, - { code: 'A'*64 } => 0, - { code: 'A'*65 } => 1 + it_behaves_like 'validates text', model_attributes, :code, + length: 1..described_class.columns_hash['code'].limit, allow_blank: true - it_behaves_like 'validates', model_attributes, :value, - { } => 0, - { value: nil } => 2, - { value: '' } => 2, - { value: 'A' } => 1, - { value: 'AA' } => 0, - { value: 'AAA' } => 0, - { value: 'A'*199 } => 0, - { value: 'A'*200 } => 0, - { value: 'A'*201 } => 1 + it_behaves_like 'validates text', model_attributes, :value, + length: 2..described_class.columns_hash['value'].limit end end