require 'spec_helper' describe BrDanfe::MdfeLib::MdfeIdentification do let(:xml_as_string) do <<~XML 32 1 2 58 1 121 00000000 3 1 2021-07-01T17:30:00-03:00 1 0 hivelog-mdfe-0.1.0 ES SC 3205069 VENDA NOVA DO IMIGRANTE 2021-07-01T17:30:00-03:00 XML end let(:pdf) { BrDanfe::MdfeLib::Document.new } let(:xml) { BrDanfe::XML.new(xml_as_string) } subject { described_class.new(pdf, xml) } let(:pdf_text) do PDF::Inspector::Text.analyze(pdf.render).strings.join("\n") end describe '#generate' do it 'generates the model' do model = "Modelo\n58" subject.generate(1) expect(pdf_text).to include model end it 'generates the series' do series = "Série\n1" subject.generate(1) expect(pdf_text).to include series end it 'generates the number' do number = "Número\n121" subject.generate(1) expect(pdf_text).to include number end it 'generates the page number' do pages = "FL\n1/1" subject.generate(1) expect(pdf_text).to include pages end it 'generates the emitted date and hour' do datetime = "Data e hora de Emissão\n01/07/2021 17:30:00" subject.generate(1) expect(pdf_text).to include datetime end it 'generates the origin uf' do origin_uf = "UF Carreg.\nES" subject.generate(1) expect(pdf_text).to include origin_uf end it 'generates the destination uf' do destination_uf = "UF Descarreg.\nSC" subject.generate(1) expect(pdf_text).to include destination_uf end end end