lib/rspec/models/unidom/position/occupation_spec.rb in unidom-position-1.5.3 vs lib/rspec/models/unidom/position/occupation_spec.rb in unidom-position-1.5.4
- old
+ new
@@ -13,23 +13,12 @@
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
+ it_behaves_like 'validates text', model_attributes, :name, length: 2..described_class.columns_hash['name'].limit
position_1_attributes = {
organization_id: SecureRandom.uuid,
organization_type: 'Unidom::Position::Organization::Mock',
name: 'Some Position #1'