Sha256: 76b82ce6ae5b92bc6b8d25a0c6cbc00eed078b466cdd421887d4f9ef496c629a

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Brcobranca::Util::Empresa do
  context 'com zero' do
    it 'CPF returns 01' do
      ['179.461.278-55', '17946127855', 17_946_127_855].each do |documento|
        expect(described_class.new(documento, true).tipo).to eq('01')
        expect(described_class.new(documento).tipo).to eq('01')
      end
    end

    it 'CNPJ returns 02' do
      ['25.716.376/0001-28', '25716376000128', 25_716_376_000_128].each do |documento|
        expect(described_class.new(documento, true).tipo).to eq('02')
        expect(described_class.new(documento).tipo).to eq('02')
      end
    end
  end

  context 'sem zero' do
    it 'CPF returns 1' do
      ['179.461.278-55', '17946127855', 17_946_127_855].each do |documento|
        expect(described_class.new(documento, false).tipo).to eq('1')
      end
    end

    it 'CNPJ returns 2' do
      ['25.716.376/0001-28', '25716376000128', 25_716_376_000_128].each do |documento|
        expect(described_class.new(documento, false).tipo).to eq('2')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brcobranca-10.0.0 spec/brcobranca/util/empresa_spec.rb