summaryrefslogtreecommitdiff
path: root/spec/jobs
diff options
context:
space:
mode:
authorAlberto Vena <kennyadsl@gmail.com>2021-07-20 16:30:43 +0200
committerGitHub <noreply@github.com>2021-07-20 16:30:43 +0200
commitc6c9fea5898530405dff44f5603e9191a679d1a6 (patch)
treee7e511496ad1bb7b0b0d32607cf634332192d69b /spec/jobs
parent662719693c9f369cd9176e432ab3d4a554822751 (diff)
parent0317e228bc79c13667940203add35fa13fac21f1 (diff)
Merge pull request #235 from solidusio-contrib/kennyadsl/log-installments-errors-by-defaultHEADmaster
Log installments errors by default
Diffstat (limited to 'spec/jobs')
-rw-r--r--spec/jobs/solidus_subscriptions/process_installment_job_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb b/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb
index bc33d0e..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,24 @@ RSpec.describe SolidusSubscriptions::ProcessInstallmentJob do
end
context 'when handling #perform errors' 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
+ allow(SolidusSubscriptions::Checkout).to receive(:new).and_return(checkout)
+ allow(Rails.logger).to receive(:error)
+
+ expect {
+ 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
+
it 'swallows error when a proc is not configured' do
+ stub_config(processing_error_handler: nil )
checkout = instance_double(SolidusSubscriptions::Checkout).tap do |c|
allow(c).to receive(:process).and_raise('test error')
end