Sha256: dccfdb67052137db13ef9da61014c9f60e100b588677ac224f0262d46a6d74b4

Contents?: true

Size: 952 Bytes

Versions: 5

Compression:

Stored size: 952 Bytes

Contents

describe Unidom::Action::Reason, type: :model do

  before :each do
  end

  after :each do
  end

  context do

    model_attributes = {
      name:          'Reason #1',
      activity_code: 'ZZZZ'
    }

    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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unidom-action-1.17.5 lib/rspec/models/unidom/action/reason_spec.rb
unidom-action-1.17.4 lib/rspec/models/unidom/action/reason_spec.rb
unidom-action-1.17.3 lib/rspec/models/unidom/action/reason_spec.rb
unidom-action-1.17.2 lib/rspec/models/unidom/action/reason_spec.rb
unidom-action-1.17.1 lib/rspec/models/unidom/action/reason_spec.rb