describe Unidom::Party::Collaborating, type: :model do before :each do end after :each do end context do model_attributes = { collaboration_id: SecureRandom.uuid, collaboration_type: 'Unidom::Party::Collaboration::Mock', collaborator_id: SecureRandom.uuid, collaborator_type: 'Unidom::Party::Collaborator::Mock', role_code: 'ZZZZ', name: 'Attention', priority: 3, grade: 5 } 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 company_attributes = { name: 'Tesla' } government_agency_attributes = { name: 'CD Gov' } person_attributes = { name: 'Tim' } shop_attributes = { name: 'WalMart' } it_behaves_like 'belongs_to', model_attributes, :collaborator, Unidom::Party::Company, company_attributes it_behaves_like 'belongs_to', model_attributes, :collaborator, Unidom::Party::GovernmentAgency, government_agency_attributes it_behaves_like 'belongs_to', model_attributes, :collaborator, Unidom::Party::Person, person_attributes it_behaves_like 'belongs_to', model_attributes, :collaborator, Unidom::Party::Shop, shop_attributes end end