blob: dcd5cfc70c79dace66246d0910f0ce0a3172d316 (
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
|
require 'spec_helper'
RSpec.describe SolidusSubscriptions::FailureDispatcher do
let(:dispatcher) { described_class.new(installments, order) }
let(:installments) { build_list(:installment, 2) }
let(:order) { create :order_with_line_items }
describe '#dispatch' do
subject { dispatcher.dispatch }
it 'marks all the installments out of stock' do
expect(installments).to all receive(:failed!).once
subject
end
it 'logs the failure' do
expect(dispatcher).to receive(:notify).once
subject
end
it 'cancels the order' do
expect { subject }.to change { order.state }.to 'canceled'
end
end
end
|