Sha256: 5d62eb613129ba8ef7cd357d22f2b286b6380071abba04fa72538ea501b43e15

Contents?: true

Size: 959 Bytes

Versions: 3

Compression:

Stored size: 959 Bytes

Contents

RSpec.describe Epics::ParseEbics do

  subject do
    Faraday.new do |builder|
      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') )  ]}
      end
      builder.use Epics::ParseEbics
    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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
epics-1.1.1 spec/middleware/parse_ebics_spec.rb
epics-1.1.0 spec/middleware/parse_ebics_spec.rb
epics-1.0.0 spec/middleware/parse_ebics_spec.rb