summaryrefslogtreecommitdiff
path: root/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb
blob: 31a9af6ded250826a9a500c77c5fb5d5ff779188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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