Sha256: 1cc4aff1095b803eabd84f21537740606d34c0f8dae69fa009295e418bd751b3

Contents?: true

Size: 990 Bytes

Versions: 2

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'

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

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

  let(:xml) do
    xml = <<-eos
      <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>
    eos

    BrDanfe::XML.new(xml)
  end

  subject { described_class.new pdf, xml }

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

    it 'renders qr-code to the pdf' do
      expect(File.exist?(output_pdf)).to be_falsey
      pdf.render_file output_pdf

      expect("#{base_dir}qr_code#render.pdf").to have_same_content_of file: output_pdf
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
br_danfe-0.12.1 spec/lib/danfe_nfce_lib/qr_code_spec.rb
br_danfe-0.12.0 spec/lib/danfe_nfce_lib/qr_code_spec.rb