summaryrefslogtreecommitdiff
path: root/spec/services/solidus_subscriptions/success_dispatcher_spec.rb
blob: ef7d255d801963fdf4de1a6d561ab017fcf6d110 (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
require 'spec_helper'

RSpec.describe SolidusSubscriptions::SuccessDispatcher do
  let(:dispatcher) { described_class.new(installments) }
  let(:installments) { create_list(:installment, 1) }

  describe 'initialization' do
    subject { dispatcher }
    it { is_expected.to be_a described_class }
  end

  describe '#dispatch' do
    subject { dispatcher.dispatch }

    it 'marks all the installments out of stock' do
      expect(installments).to all receive(:success!).once
      subject
    end

    it 'logs the failure' do
      expect(dispatcher).to receive(:notify).once
      subject
    end
  end
end