Sha256: 1084dd89f237288d8f29502167ed9dc84a91b9444a13ee43281bfac85b8dee2f

Contents?: true

Size: 972 Bytes

Versions: 6

Compression:

Stored size: 972 Bytes

Contents

require "spec_helper"

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby_danfe-1.15.4 spec/lib/cst_spec.rb
ruby_danfe-1.15.2 spec/lib/cst_spec.rb
ruby_danfe-1.15.1 spec/lib/cst_spec.rb
ruby_danfe-1.15.0 spec/lib/cst_spec.rb
ruby_danfe-1.13.2 spec/lib/cst_spec.rb
ruby_danfe-1.11.5 spec/lib/cst_spec.rb