lib/rspec/models/unidom/position/occupation_spec.rb in unidom-position-1.5 vs lib/rspec/models/unidom/position/occupation_spec.rb in unidom-position-1.5.1

- old
+ new

@@ -13,10 +13,23 @@ scheme_type: 'Unidom::Position::Scheme::Mock', code: '5-1-99', name: 'Some Occupation' } + name_max_length = described_class.columns_hash['name'].limit + it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes + + it_behaves_like 'validates', model_attributes, :name, + { } => 0, + { name: nil } => 2, + { name: '' } => 2, + { name: 'A' } => 1, + { name: 'AA' } => 0, + { name: 'AAA' } => 0, + { name: 'A'*(name_max_length-1) } => 0, + { name: 'A'*name_max_length } => 0, + { name: 'A'*(name_max_length+1) } => 1 end end