Sha256: 01bfeb14771b89b4874d0696218b2f409eaa75c4a78379b5c3ba6e32b09c3d05

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

describe Unidom::ArticleNumber::Ean8Barcode, type: :model do

  before :each do
  end

  after :each do
  end

  context do

    model_attributes = {
      code: '12345678'
    }

    it_behaves_like 'Unidom::Common::Concerns::ModelExtension',   model_attributes
    it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attributes

    code_max_length = described_class.columns_hash['code'].limit
    it_behaves_like 'validates', model_attributes, :code,
      {             } => 0,
      { code: nil   } => 3,
      { code: ''    } => 3,
      { code: '1'   } => 1,
      { code: 'A'   } => 2,
      { code: '11'  } => 1,
      { code: 'AA'  } => 2,
      { code: '111' } => 1,
      { code: 'AAA' } => 2,
      { code: '1'*(code_max_length-1) } => 1,
      { code: 'A'*(code_max_length-1) } => 2,
      { code: '1'*code_max_length     } => 0,
      { code: 'A'*code_max_length     } => 1,
      { code: '1'*(code_max_length+1) } => 1,
      { code: 'A'*(code_max_length+1) } => 2

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
unidom-article_number-3.0.1 lib/rspec/models/unidom/article_number/ean8_barcode_spec.rb
unidom-article_number-3.0 lib/rspec/models/unidom/article_number/ean8_barcode_spec.rb
unidom-article_number-2.3.7 lib/rspec/models/unidom/article_number/ean8_barcode_spec.rb