diff options
Diffstat (limited to 'spec/jobs')
-rw-r--r-- | spec/jobs/solidus_subscriptions/process_installment_job_spec.rb | 11 | ||||
-rw-r--r-- | spec/jobs/solidus_subscriptions/process_installments_job_spec.rb | 28 |
2 files changed, 11 insertions, 28 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 diff --git a/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb b/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb deleted file mode 100644 index 111fc05..0000000 --- a/spec/jobs/solidus_subscriptions/process_installments_job_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'spec_helper' - -RSpec.describe SolidusSubscriptions::ProcessInstallmentsJob do - let(:root_order) { create :completed_order_with_pending_payment } - let(:installments) do - traits = { - subscription_traits: [{ - user: root_order.user, - 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::Checkout). - to receive(:process).once - - subject - end - end -end |