lib/rspec/models/unidom/contact/contact_subscription_spec.rb in unidom-contact-1.4 vs lib/rspec/models/unidom/contact/contact_subscription_spec.rb in unidom-contact-1.4.1

- old
+ new

@@ -14,10 +14,23 @@ subscriber_id: SecureRandom.uuid, subscriber_type: 'Unidom::Contact::Subscriber::Mock', name: 'Home' } + 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: 'Al' } => 0, + { name: 'Bob' } => 0, + { name: 'A'*(name_max_length-1) } => 0, + { name: 'A'*name_max_length } => 0, + { name: 'A'*(name_max_length+1) } => 1 end end