Sha256: 70e6b4d81ff01e96050ed6ab46a534c98c7798dbf810324119898260f1f6121d

Contents?: true

Size: 996 Bytes

Versions: 3

Compression:

Stored size: 996 Bytes

Contents

require 'spec_helper'

describe BrDanfe::DanfeLib::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::Cst.to_danfe(xml_cst)).to eq '500'
      end
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
br_danfe-0.12.1 spec/lib/danfe_lib/cst_spec.rb
br_danfe-0.12.0 spec/lib/danfe_lib/cst_spec.rb
br_danfe-0.11.2 spec/lib/danfe_lib/cst_spec.rb