Sha256: 1f5c7a2b112350810557431b9a25d1a5a9e7ace11cf99e4bf0cac1bcb1d32b67

Contents?: true

Size: 1020 Bytes

Versions: 13

Compression:

Stored size: 1020 Bytes

Contents

require 'spec_helper'

describe BrDanfe::DanfeLib::NfeLib::Cst do
  let(:xml_cst) do
    xml = <<-eos
      <imposto>
        <ICMS>
          <ICMS00>
            <orig>5</orig>
            <CST>00</CST>
            <modBC>3</modBC>
            <vBC>49.23</vBC>
            <pICMS>12.00</pICMS>
            <vICMS>5.90</vICMS>
          </ICMS00>
        </ICMS>
      </imposto>
    eos

    Nokogiri::XML(xml)
  end

  let(:xml_csosn) do
    xml = <<-eos
      <imposto>
        <ICMS>
          <ICMSSN102>
            <orig>4</orig>
            <CSOSN>102</CSOSN>
          </ICMSSN102>
        </ICMS>
      </imposto>
    eos

    Nokogiri::XML(xml)
  end

  describe '.to_danfe' do
    context 'when CST' do
      it 'returns origin + CST' do
        expect(BrDanfe::DanfeLib::NfeLib::Cst.to_danfe(xml_cst)).to eq '500'
      end
    end

    context 'when CSOSN' do
      it 'returns origin + CSOSN' do
        expect(BrDanfe::DanfeLib::NfeLib::Cst.to_danfe(xml_csosn)).to eq '4102'
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
br_danfe-0.17.0 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.16.0 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.15.1 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.15.0 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.14.5 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.14.4 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.14.3 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.14.2 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.14.0 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.13.3 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.13.2 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.13.1 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb
br_danfe-0.13.0 spec/br_danfe/danfe_lib/nfe_lib/cst_spec.rb