Sha256: 62b3e4594064632eedd18ba1bfc9cd760483fdfe560331706cf60e01375a14da

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
require_relative 'shared_examples_for_to_remove_all_masks'

describe BrDocuments::IE::SC do
  describe '#formatted' do
    it 'returns a formatted ie' do
      ie = described_class.new('123456789')
      expect(ie.formatted).to eq '123.456.789'
    end
  end

  describe '#valid?' do
    it 'is invalid with malformed number' do
      ['253.66.7852', '25.4062.407', 'A12345678'].each do |number|
        ie = described_class.new(number)
        expect(ie).not_to be_valid
      end
    end

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

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

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

    include_examples 'for to remove all masks', '254.062.407'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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