summaryrefslogtreecommitdiff
path: root/spec/jobs
diff options
context:
space:
mode:
authorBrendan Deere <brendan@stembolt.com>2016-09-23 15:04:11 -0700
committerBrendan Deere <brendan@stembolt.com>2016-09-23 15:17:40 -0700
commit9050d2aab63da6afabb8ef354ba984c4a6f846d9 (patch)
tree29f19df6df11ff79dc1b893c52b1e01703eba4fe /spec/jobs
parent8d58933a681bb894ac3acdbdb280467b9a88bbeb (diff)
Add ProcessInstallmentsJob
This job is responsible for creating a consolidated installment from a list of installments and processing it.
Diffstat (limited to 'spec/jobs')
-rw-r--r--spec/jobs/solidus_subscriptions/process_installments_job_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb b/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb
new file mode 100644
index 0000000..31a9af6
--- /dev/null
+++ b/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb
@@ -0,0 +1,27 @@
+require 'rails_helper'
+
+RSpec.describe SolidusSubscriptions::ProcessInstallmentsJob do
+ let(:root_order) { create :completed_order_with_pending_payment }
+ let(:installments) do
+ traits = {
+ subscription_traits: [{
+ line_item_traits: [{
+ spree_line_item: root_order.line_items.first
+ }]
+ }]
+ }
+
+ create_list(:installment, 2, traits)
+ end
+
+ describe '#perform' do
+ subject { described_class.new.perform(installments) }
+
+ it 'processes the consolidated installment' do
+ expect_any_instance_of(SolidusSubscriptions::ConsolidatedInstallment).
+ to receive(:process).once
+
+ subject
+ end
+ end
+end