Sha256: 85aed2b5e93327376a4084e90acdfa565edd5d768405e9b5be0aa43ca0387e11

Contents?: true

Size: 996 Bytes

Versions: 27

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

27 entries across 27 versions & 1 rubygems

Version Path
br_danfe-0.4.1 spec/lib/danfe_lib/cst_spec.rb
br_danfe-0.4.0 spec/lib/danfe_lib/cst_spec.rb
br_danfe-0.3.0 spec/lib/danfe_lib/cst_spec.rb
br_danfe-0.2.3 spec/lib/danfe_lib/cst_spec.rb
br_danfe-0.2.2 spec/lib/danfe_lib/cst_spec.rb
br_danfe-0.2.1 spec/lib/danfe_lib/cst_spec.rb
br_danfe-0.2.0 spec/lib/danfe_lib/cst_spec.rb