Sha256: 4d15c1078bba33eed7891e585c92ad5adbbf7476eb103d336cae5e8034043686

Contents?: true

Size: 1.02 KB

Versions: 17

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe BrDanfe::MdfeLib::AuthorizationProtocol do
  let(:xml_as_string) do
    <<~XML
      <?xml version="1.0" encoding="UTF-8"?>
      <mdfeProc xmlns="http://www.portalfiscal.inf.br/mdfe" versao="3.00">
        <protMDFe versao="3.00" xmlns="http://www.portalfiscal.inf.br/mdfe">
          <infProt Id="MDFe932210002534081">
            <dhRecbto>2021-07-01T17:39:16-03:00</dhRecbto>
            <nProt>932210002534081</nProt>
          </infProt>
        </protMDFe>
      </mdfeProc>
    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 authorization protocol' do
      authorization_protocol = "Protocolo de autorização\n932210002534081 - 01/07/2021 17:39:16-03:00"

      subject.generate
      expect(pdf_text).to include authorization_protocol
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
br_danfe-1.2.1 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-1.2.0 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-1.1.0 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-1.0.0 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.20.0 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.19.0 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.18.0 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.8 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.7 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.6 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.5 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.4 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.3 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.2 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.1 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.17.0 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb
br_danfe-0.16.0 spec/br_danfe/mdfe_lib/authorization_protocol_spec.rb