diff options
author | Alberto Vena <kennyadsl@gmail.com> | 2021-07-12 17:04:48 +0200 |
---|---|---|
committer | Alberto Vena <kennyadsl@gmail.com> | 2021-07-13 16:23:34 +0200 |
commit | 0317e228bc79c13667940203add35fa13fac21f1 (patch) | |
tree | e7e511496ad1bb7b0b0d32607cf634332192d69b /spec/jobs | |
parent | c9e26197b0abbe50b029c368017243314d572884 (diff) |
Pass installment to the processing error handler
This way we can provide more flexibility on things that can be
done when an error occurs.
In the provided RailsLogger handler, we'll also print the ID
of the installment.
Diffstat (limited to 'spec/jobs')
-rw-r--r-- | spec/jobs/solidus_subscriptions/process_installment_job_spec.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb b/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb index 7211cfe..767d650 100644 --- a/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb +++ b/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb @@ -12,7 +12,8 @@ RSpec.describe SolidusSubscriptions::ProcessInstallmentJob do end context 'when handling #perform errors' do - it 'by default logs exception data without raising exceptions' do + it 'by default logs exception data without raising exceptions' do # rubocop:disable RSpec/MultipleExpectations + installment = build_stubbed(:installment) checkout = instance_double(SolidusSubscriptions::Checkout).tap do |c| allow(c).to receive(:process).and_raise('test error') end @@ -20,9 +21,10 @@ RSpec.describe SolidusSubscriptions::ProcessInstallmentJob do allow(Rails.logger).to receive(:error) expect { - described_class.perform_now(build_stubbed(:installment)) + described_class.perform_now(installment) }.not_to raise_error + expect(Rails.logger).to have_received(:error).with("Error processing installment with ID=#{installment.id}:").ordered expect(Rails.logger).to have_received(:error).with("test error").ordered end |