Sha256: decdb934c8954f047d1b28f7be483e5972b987aaa3d8147f5078a7c1386524b7

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

module CorreiosSigep
  module Builders
    module XML
      describe Request do
        describe '.build_xml' do
          let(:request) { double(:request, to_xml: '<root><test></root>') }
          context 'when do not override anything' do
            it 'builds a Authentication XML with Configuration parameters' do
              expected_response = [
                '<codAdministrativo>08082650</codAdministrativo><test/>'
              ].join + "\n"
              expect(described_class.build_xml request).to eq expected_response
            end
          end

          context 'when override the administrative fields' do
            it 'builds a Authentication XML with the override parameter' do
              administrative_fields = Models::AdministrativeFields.new(administrative_code: 'adm123',
                                                                       card: 'card123',
                                                                       service_code: 'ser123')
              expected_response = [
                '<codAdministrativo>adm123</codAdministrativo><test/>'
              ].join + "\n"
              expect(described_class.build_xml request, administrative: administrative_fields).to eq expected_response
            end
          end

        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
correios_sigep-1.0.0 spec/correios_sigep/builders/xml/request_spec.rb