Sha256: 7ec7aa32ddbb3860610555051611dd7a0e44e2076ef34c5a5037b9be31885fce
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 KB
Contents
RSpec.describe Epics::ParseEbics do subject do Faraday.new do |builder| builder.use Epics::ParseEbics builder.adapter :test, Faraday::Adapter::Test::Stubs.new do |stub| stub.post('/business_nok') {[ 200, {}, File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'ebics_business_nok.xml') ) ]} stub.post('/technical_nok') {[ 200, {}, File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'ebics_technical_nok.xml') ) ]} stub.post('/ok') {[ 200, {}, File.read( File.join( File.dirname(__FILE__), '..', 'fixtures', 'xml', 'hpb_response_ebics_ns.xml') ) ]} end end end it "will handle errornous response with raising the related error class" do expect { subject.post("/business_nok") }.to raise_error(Epics::Error::BusinessError, "EBICS_PROCESSING_ERROR - During processing of the EBICS request, other business-related errors have ocurred") expect { subject.post("/technical_nok") }.to raise_error(Epics::Error::TechnicalError, "EBICS_AUTHENTICATION_FAILED - Authentication signature error") end it "will parsed as Epics::Response" do expect(subject.post("/ok").body).to be_kind_of(Epics::Response) end end
Version data entries
5 entries across 5 versions & 1 rubygems