Sha256: fbaf200dd755e8821a725a40078c5030a2902acf1bd09c3e36f7e3c973bce3c6

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

require 'spec_helper'

module Afipws
  describe Client do
    context 'manejo de errores' do
      subject { Client.new(wsdl: Afipws::WSFE::WSDL[:test]) }

      it 'Savon::SOAPFault se encapsulan en ServerError' do
        savon.expects(:fe_dummy).returns(fixture('wsaa/login_cms/fault'))
        -> { subject.request :fe_dummy }.should raise_error ServerError, /CMS no es valido/
      end

      it 'HTTPClient::TimeoutError se encapsulan en NetworkError' do
        # Hack to mock exceptions on Savon
        subject.instance_eval('@savon').expects(:call).raises(HTTPClient::ReceiveTimeoutError, 'execution expired')
        -> { subject.request :fe_dummy }.should raise_error NetworkError, /execution expired/
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
afipws-2.1.0 spec/afipws/client_spec.rb
afipws-2.0.0 spec/afipws/client_spec.rb