Sha256: 28332c838269642c21e1ee13a28a9ddfd50a9865eb4865e8d1beac55721cf43a

Contents?: true

Size: 801 Bytes

Versions: 7

Compression:

Stored size: 801 Bytes

Contents

require 'spec_helper'

describe BrDanfe::Danfe do
  let(:xml) do
    <<-eos
      <nfeProc>
        <NFe>
          <infNFe>
            <ide>
              <mod>#{mod}</mod>
              <NFref>
                <refNFP>
                  <mod>04</mod>
                </refNFP>
              </NFref>
            </ide>
          </infNFe>
        </NFe>
      </nfeProc>
    eos
  end

  subject { described_class.new(xml) }

  context 'when the xml document type is NF-e' do
    let(:mod) { 55 }

    it 'returns a NF-e danfe class' do
      expect(subject.class).to eq BrDanfe::DanfeLib::Nfe
    end
  end

  context 'when the xml document type is NFC-e' do
    let(:mod) { 65 }

    it 'returns a NFC-e danfe class' do
      expect(subject.class).to eq BrDanfe::DanfeLib::Nfce
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
br_danfe-0.14.5 spec/br_danfe/danfe_spec.rb
br_danfe-0.14.4 spec/br_danfe/danfe_spec.rb
br_danfe-0.14.3 spec/br_danfe/danfe_spec.rb
br_danfe-0.14.2 spec/br_danfe/danfe_spec.rb
br_danfe-0.14.0 spec/br_danfe/danfe_spec.rb
br_danfe-0.13.3 spec/br_danfe/danfe_spec.rb
br_danfe-0.13.2 spec/br_danfe/danfe_spec.rb