mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
Extract order-updating logic to Order::Updater
This commit is contained in:
@@ -556,11 +556,19 @@ describe Spree::Payment do
|
||||
end
|
||||
|
||||
context "completed orders" do
|
||||
let(:order_updater) { OrderManagement::Order::Updater.new(order) }
|
||||
|
||||
before { allow(order).to receive(:completed?) { true } }
|
||||
|
||||
it "updates payment_state and shipments" do
|
||||
expect(order.updater).to receive(:update_payment_state)
|
||||
expect(order.updater).to receive(:update_shipment_state)
|
||||
expect(OrderManagement::Order::Updater).to receive(:new).with(order).
|
||||
and_return(order_updater)
|
||||
|
||||
expect(order_updater).to receive(:after_payment_update).with(kind_of(Spree::Payment)).
|
||||
and_call_original
|
||||
|
||||
expect(order_updater).to receive(:update_payment_state)
|
||||
expect(order_updater).to receive(:update_shipment_state)
|
||||
create(:payment, amount: 100, order: order)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user