Sha256: 856d5d9dc6d1aefea331a1357d5c312bab3f9e59eecbe03b5e7710f04c7e56be
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
require 'spec_helper' module Afipws describe Client do context '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 'Savon::HTTPError se encapsulan en ServerError' do expect_savon_to_raise Savon::HTTPError, stub(code: 503, body: 'Service Unavailable') -> { subject.request :fe_dummy }.should raise_error ServerError, /Service Unavailable/ end it 'HTTPClient::TimeoutError se encapsulan en NetworkError y no es retriable' do expect_savon_to_raise HTTPClient::ReceiveTimeoutError, 'execution expired' -> { subject.request :fe_dummy }.should raise_error { |error| error.should be_a NetworkError error.message.should match /execution expired/ error.retriable?.should be false } end it 'HTTPClient::ConnectTimeoutError se encapsulan en NetworkError y es retriable' do expect_savon_to_raise HTTPClient::ConnectTimeoutError, 'execution expired' -> { subject.request :fe_dummy }.should raise_error { |error| error.should be_a NetworkError error.message.should match /execution expired/ error.retriable?.should be true } end def expect_savon_to_raise error_class, message # Hack to mock exceptions on Savon subject.instance_eval('@savon', __FILE__, __LINE__).expects(:call).raises(error_class, message) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
afipws-2.3.0 | spec/afipws/client_spec.rb |
afipws-2.2.0 | spec/afipws/client_spec.rb |