From b84bba6d03ae00bc7b4b297e990b662282da85b8 Mon Sep 17 00:00:00 2001 From: Georg Ledermann Date: Fri, 15 Apr 2022 06:37:19 +0200 Subject: [PATCH] Tests: Check for error messages --- spec/credit_transfer_spec.rb | 12 ++++++------ spec/direct_debit_spec.rb | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spec/credit_transfer_spec.rb b/spec/credit_transfer_spec.rb index 98dea2a..0a77d80 100644 --- a/spec/credit_transfer_spec.rb +++ b/spec/credit_transfer_spec.rb @@ -38,7 +38,7 @@ it 'should fail' do expect { SEPA::CreditTransfer.new.to_xml - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Name is too short/) end end @@ -118,13 +118,13 @@ it 'should fail for pain.001.001.03' do expect { subject.to_xml(SEPA::PAIN_001_001_03) - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Incompatible with schema/) end it 'should fail for pain.001.002.03' do expect { subject.to_xml(SEPA::PAIN_001_002_03) - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Incompatible with schema/) end end @@ -381,13 +381,13 @@ it 'should fail for pain.001.002.03' do expect { subject.to_xml(SEPA::PAIN_001_002_03) - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Incompatible with schema/) end it 'should fail for pain.001.003.03' do expect { subject.to_xml(SEPA::PAIN_001_003_03) - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Incompatible with schema/) end end @@ -409,7 +409,7 @@ it 'should fail for pain.001.002.03' do expect { subject.to_xml(SEPA::PAIN_001_002_03) - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Incompatible with schema/) end it 'should validate against pain.001.003.03' do diff --git a/spec/direct_debit_spec.rb b/spec/direct_debit_spec.rb index c480cee..adc17f5 100644 --- a/spec/direct_debit_spec.rb +++ b/spec/direct_debit_spec.rb @@ -70,7 +70,7 @@ it 'should fail' do expect { SEPA::DirectDebit.new.to_xml - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Name is too short/) end end @@ -158,7 +158,7 @@ it 'should fail for pain.008.002.02' do expect { subject.to_xml(SEPA::PAIN_008_002_02) - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Incompatible with schema/) end it 'should validate against pain.008.001.02' do @@ -385,7 +385,7 @@ it 'should raise error on XML generation' do expect { subject.to_xml - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /CORE, COR1 AND B2B must not be mixed in one message/) end end @@ -533,7 +533,7 @@ end it 'should fail as the payment identification becomes too large' do - expect { subject.to_xml }.to raise_error(SEPA::Error) + expect { subject.to_xml }.to raise_error(SEPA::Error, /The value has a length of '37'; this exceeds the allowed maximum length of '35'/) end end @@ -562,13 +562,13 @@ it 'should fail for pain.008.002.02' do expect { subject.to_xml(SEPA::PAIN_008_002_02) - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Incompatible with schema/) end it 'should fail for pain.008.003.02' do expect { subject.to_xml(SEPA::PAIN_008_003_02) - }.to raise_error(SEPA::Error) + }.to raise_error(SEPA::Error, /Incompatible with schema/) end end end