summaryrefslogtreecommitdiff
path: root/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-11-19 13:14:14 +0100
committerAlessandro Desantis <desa.alessandro@gmail.com>2021-01-30 15:23:41 +0100
commit0a0659d1150a7df8f0ca23e4876672e95a103f51 (patch)
treeb5d85692c5d9c6d168093a44bbddc10431aa366c /spec/jobs/solidus_subscriptions/process_installment_job_spec.rb
parent5081ffc17562fa90edf0f2a8dfa0d03991480362 (diff)
Process one installment at a time in background jobs
Instead of attempting to process multiple installments at a time, which increases the chances something might go wrong, we are now only processing one installment at a time. This also improves the extension's performance, because the installments can be processed in parallel.
Diffstat (limited to 'spec/jobs/solidus_subscriptions/process_installment_job_spec.rb')
-rw-r--r--spec/jobs/solidus_subscriptions/process_installment_job_spec.rb11
1 files changed, 11 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
new file mode 100644
index 0000000..4a33819
--- /dev/null
+++ b/spec/jobs/solidus_subscriptions/process_installment_job_spec.rb
@@ -0,0 +1,11 @@
+RSpec.describe SolidusSubscriptions::ProcessInstallmentJob do
+ it 'processes checkout for the installment' do
+ installment = build_stubbed(:installment)
+ checkout = instance_spy(SolidusSubscriptions::Checkout)
+ allow(SolidusSubscriptions::Checkout).to receive(:new).with(installment).and_return(checkout)
+
+ described_class.perform_now(installment)
+
+ expect(checkout).to have_received(:process)
+ end
+end