Sha256: 8a8489c67374baa3b106b8f0b422dabd10e29bf870f8a9cde0173bf80d551a55

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe BrDanfe::DanfeLib::XML do
  subject { BrDanfe::DanfeLib::XML.new(xml_as_string) }

  describe '#version_is_310_or_newer?' do
    describe "when xml's version is equal 3.10" do
      let(:xml_as_string) do
        <<-eos
          <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
            <infNFe versao="3.10" Id="NFe35150162013294000143550010000000011000000017">
            </infNFe>
          </NFe>
        eos
      end

      it 'returns true' do
        expect(subject.version_is_310_or_newer?).to eql true
      end
    end

    describe "when xml's version is greather 3.10" do
      let(:xml_as_string) do
        <<-eos
          <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
            <infNFe versao="4.00" Id="NFe35150162013294000143550010000000011000000017">
            </infNFe>
          </NFe>
        eos
      end

      it 'returns true' do
        expect(subject.version_is_310_or_newer?).to eql true
      end
    end

    describe "when xml's version is minor that 3.10" do
      let(:xml_as_string) do
        <<-eos
          <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
            <infNFe versao="2.00" Id="NFe35131260891033000109550010000000011000000016">
            </infNFe>
          </NFe>
        eos
      end

      it 'returns false' do
        expect(subject.version_is_310_or_newer?).to eql false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
br_danfe-0.11.2 spec/lib/danfe_lib/xml_spec.rb