Sha256: ba21224d9bf05886c6bfe837db33256d3c03b5d70d438c8d94ace169ce1890cb

Contents?: true

Size: 1.12 KB

Versions: 15

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

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

  subject { described_class.new(xml) }

  context 'xmls parameter' do
    let(:mod) { 55 }

    it 'accepts one xml' do
      subject = described_class.new(xml)

      expect(subject.class).to eq BrDanfe::DanfeLib::Nfe
    end

    it 'accepts an array of xmls' do
      subject = described_class.new([xml, xml])

      expect(subject.class).to eq BrDanfe::DanfeLib::Nfe
    end
  end

  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

15 entries across 15 versions & 1 rubygems

Version Path
br_danfe-1.2.1 spec/br_danfe/danfe_spec.rb
br_danfe-1.2.0 spec/br_danfe/danfe_spec.rb
br_danfe-1.1.0 spec/br_danfe/danfe_spec.rb
br_danfe-1.0.0 spec/br_danfe/danfe_spec.rb
br_danfe-0.20.0 spec/br_danfe/danfe_spec.rb
br_danfe-0.19.0 spec/br_danfe/danfe_spec.rb
br_danfe-0.18.0 spec/br_danfe/danfe_spec.rb
br_danfe-0.17.8 spec/br_danfe/danfe_spec.rb
br_danfe-0.17.7 spec/br_danfe/danfe_spec.rb
br_danfe-0.17.6 spec/br_danfe/danfe_spec.rb
br_danfe-0.17.5 spec/br_danfe/danfe_spec.rb
br_danfe-0.17.4 spec/br_danfe/danfe_spec.rb
br_danfe-0.17.3 spec/br_danfe/danfe_spec.rb
br_danfe-0.17.2 spec/br_danfe/danfe_spec.rb
br_danfe-0.17.1 spec/br_danfe/danfe_spec.rb