Sha256: bad8c46f451c004b03a7f1a8c38bad69ddfd71ae8073755d70b77290425c955c

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'
require_relative 'shared_examples_for_to_remove_all_masks'

describe BrDocuments::IE::DF do
  describe '#formatted' do
    it 'returns a formatted ie' do
      ie = described_class.new('1234567890123')
      expect(ie.formatted).to eq '12345678901-23'
    end
  end

  describe '#valid?' do
    it 'is invalid with malformed number' do
      ['070648022871-3', '07.064.802.287-13', '0AB49871799-12'].each do |number|
        ie = described_class.new(number)
        expect(ie).not_to be_valid
      end
    end

    it 'is invalid with length different to 13' do
      ['1234567890', '123456789012345'].each do |number|
        ie = described_class.new(number)
        expect(ie).not_to be_valid
      end
    end

    it 'is invalid with invalid check number' do
      ['0733002219945', '0733002219943'].each do |number|
        ie = described_class.new(number)
        expect(ie).not_to be_valid
      end
    end

    it 'is valid with valid number' do
      ['0746069399231', '0784748156211'].each do |number|
        ie = described_class.new(number)
        expect(ie).to be_valid
      end
    end

    include_examples 'for to remove all masks', '07847481562-11'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
br_documents-0.2.5 spec/br_documents/ie/df_spec.rb
br_documents-0.2.4 spec/br_documents/ie/df_spec.rb
br_documents-0.2.3 spec/br_documents/ie/df_spec.rb
br_documents-0.2.2 spec/br_documents/ie/df_spec.rb
br_documents-0.2.1 spec/br_documents/ie/df_spec.rb