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 www.sefaz.am.gov.br/nfce/consulta 42200310845180000166550010000016291182910232 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