Sha256: ebd3a2d44de50e736e48596080607de0a1663757761517126c06024ca598498f

Contents?: true

Size: 1.36 KB

Versions: 15

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe BrDanfe::XML do
  subject { described_class.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
        <<~XML
          <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
            <infNFe versao="3.10" Id="NFe35150162013294000143550010000000011000000017">
            </infNFe>
          </NFe>
        XML
      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
        <<~XML
          <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
            <infNFe versao="4.00" Id="NFe35150162013294000143550010000000011000000017">
            </infNFe>
          </NFe>
        XML
      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
        <<~XML
          <NFe xmlns="http://www.portalfiscal.inf.br/nfe">
            <infNFe versao="2.00" Id="NFe35131260891033000109550010000000011000000016">
            </infNFe>
          </NFe>
        XML
      end

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

Version data entries

15 entries across 15 versions & 1 rubygems

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