Sha256: bb20ad5ba04bad5c07e82cbe5fbddf007daeead8b7d4a53c370f346c33fbf9a7

Contents?: true

Size: 1.29 KB

Versions: 13

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

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

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

  let(:xml_footer) do
    xml = <<-eos
      <nfeProc>
        <NFe>
          <infNFe>
            <total>
              <ICMSTot>
                <vTotTrib>7.50</vTotTrib>
              </ICMSTot>
           </total>
          </infNFe>
        </NFe>
      </nfeProc>
    eos

    BrDanfe::XML.new(xml)
  end

  subject { described_class.new pdf, xml_footer }

  describe '#render' do
    before { File.delete(output_pdf) if File.exist?(output_pdf) }
    it 'renders footer to the pdf' do
      subject.render
      expect(File.exist?(output_pdf)).to be_falsey

      pdf.render_file output_pdf

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

    context 'when has footer info' do
      it 'renders footer with additional information to the pdf' do
        subject.render('Informação Adicional')
        expect(File.exist?(output_pdf)).to be_falsey

        pdf.render_file output_pdf

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