lib/rspec/models/unidom/party/company_spec.rb in unidom-party-1.9.1 vs lib/rspec/models/unidom/party/company_spec.rb in unidom-party-1.9.2

- old
+ new

@@ -10,10 +10,29 @@ model_attributes = { name: 'Tesla' } + 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: '1' } => 1, + { name: 'A' } => 1, + { name: '11' } => 0, + { name: 'AA' } => 0, + { name: '111' } => 0, + { name: 'AAA' } => 0, + { name: '1'*(name_max_length-1) } => 0, + { name: 'A'*(name_max_length-1) } => 0, + { name: '1'*name_max_length } => 0, + { name: 'A'*name_max_length } => 0, + { name: '1'*(name_max_length+1) } => 1, + { name: 'A'*(name_max_length+1) } => 1 end end