require 'spec_helper' describe BrDanfe::DanfeLib::Cst do let(:xml_cst) do xml = <<-eos 5 00 3 49.23 12.00 5.90 eos Nokogiri::XML(xml) end let(:xml_csosn) do xml = <<-eos 4 102 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