Sha256: dc4b63aba68078c18d7e36473f7ee6b0683c59059a502b8d6751bc628ec79138
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
require 'spec_helper' require_relative 'shared_examples_for_to_remove_all_masks' describe BrDocuments::IE::PE do describe '#formatted' do context 'when having 9 digits' do it 'returns a formatted ie' do ie = described_class.new('123456789') expect(ie.formatted).to eq '1234567-89' end end context 'when having 14 digits' do it 'returns a formatted ie' do ie = described_class.new('18100100000049') expect(ie.formatted).to eq '18.1.001.0000004-9' end end end describe '#valid?' do it 'is invalid with malformed number' do ['15711188-1', '3.661.165-41', '3AB8287-00', '18.1.001.000000-49'].each do |number| ie = described_class.new(number) expect(ie).to_not be_valid end end it 'is invalid with length different to 9 or 14' do ['1234567', '12345678901', '0123456789012345'].each do |number| ie = described_class.new(number) expect(ie).to_not be_valid end end context 'when having 9 digits' do it 'is invalid with invalid check number' do ie = described_class.new('838872602') expect(ie).to_not be_valid end it 'is valid with valid number' do ie = described_class.new('418873607') expect(ie).to be_valid end end context 'when having 14 digits' do it 'is invalid with invalid check number' do ie = described_class.new('18100100000048') expect(ie).to_not be_valid end it 'is valid with valid number' do ie = described_class.new('18100100000049') expect(ie).to be_valid end end include_examples 'for to remove all masks', '18.1.001.0000004-9' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
br_documents-0.2.0 | spec/ie/pe_spec.rb |