summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/jobs/solidus_subscriptions/process_installment_job_spec.rb17
1 files changed, 15 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 658e252..bc33d0e 100644
--- a/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb
+++ b/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb
@@ -13,13 +13,26 @@ RSpec.describe SolidusSubscriptions::ProcessInstallmentJob do
context 'when handling #perform errors' do
it 'swallows error when a proc is not configured' do
- expect { described_class.perform_now(nil) }.not_to raise_error(StandardError)
+ 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)
+
+ expect {
+ described_class.perform_now(build_stubbed(:installment))
+ }.not_to raise_error
end
it 'runs proc when a proc is configured' do
stub_config(processing_error_handler: proc { |e| raise e } )
+ 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)
- expect { described_class.perform_now(nil) }.to raise_error(StandardError)
+ expect {
+ described_class.perform_now(build_stubbed(:installment))
+ }.to raise_error(/test error/)
end
end
end