blob: 6a718003ff4da7fb2ebbee12b48e7c7706d6c184 (
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
28
|
RSpec.describe SolidusSubscriptions::Dispatcher::SuccessDispatcher do
describe '#dispatch' do
it 'marks the installment as success' do
installment = instance_spy(SolidusSubscriptions::Installment)
order = create(:order_with_line_items)
dispatcher = described_class.new(installment, order)
dispatcher.dispatch
expect(installment).to have_received(:success!).with(order)
end
it 'fires an installments_succeeded event' do
stub_const('Spree::Event', class_spy(Spree::Event))
installment = instance_spy(SolidusSubscriptions::Installment)
order = create(:order_with_line_items)
dispatcher = described_class.new(installment, order)
dispatcher.dispatch
expect(Spree::Event).to have_received(:fire).with(
'solidus_subscriptions.installment_succeeded',
installment: installment,
order: order,
)
end
end
end
|