Sha256: f7b5f159bdb3aa44acfbd70f32a2112add9433d03993c3bf09546d33ddd9195a

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe BrDanfe::DanfeLib::NfceLib::Key do
  let(:base_dir) { './spec/fixtures/nfce/lib/' }
  let(:output_pdf) { "#{base_dir}output.pdf" }

  let(:xml_key) do
    xml = <<-eos
      <nfeProc>
        <NFe>
          <infNFeSupl>
            <qrCode><![CDATA[http://sistemas.sefaz.am.gov.br/nfceweb/consultarNFCe.jsp?p=13130901144012000152651231234567891123456786|2|2|1|A604FD51E40ED8465B787B3E9CF8C1D90E61DB13]]></qrCode>
            <urlChave>www.sefaz.am.gov.br/nfce/consulta</urlChave>
          </infNFeSupl>
        </NFe>
        <protNFe versao="4.00">
          <infProt>
            <chNFe>42200310845180000166550010000016291182910232</chNFe>
          </infProt>
        </protNFe>
      </nfeProc>
    eos

    BrDanfe::XML.new(xml)
  end

  let(:pdf) { BrDanfe::DanfeLib::NfceLib::Document.new(8.cm, 5.cm) }

  subject { described_class.new pdf, xml_key }

  describe '#render' do
    before do
      subject.render
      File.delete(output_pdf) if File.exist?(output_pdf)
    end

    it 'renders key to the pdf' do
      expect(File.exist?(output_pdf)).to be_falsey

      pdf.render_file output_pdf

      expect("#{base_dir}key#render.pdf").to have_same_content_of file: output_pdf
    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/nfce_lib/key_spec.rb
br_danfe-0.16.0 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.15.1 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.15.0 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.14.5 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.14.4 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.14.3 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.14.2 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.14.0 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.13.3 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.13.2 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.13.1 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb
br_danfe-0.13.0 spec/br_danfe/danfe_lib/nfce_lib/key_spec.rb