mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Use service in admin/orders/customer_details#update
This commit is contained in:
@@ -6,7 +6,8 @@ Spree::Admin::Orders::CustomerDetailsController.class_eval do
|
||||
if params[:guest_checkout] == "false"
|
||||
@order.associate_user!(Spree.user_class.find_by_email(@order.email))
|
||||
end
|
||||
while @order.next; end
|
||||
|
||||
AdvanceOrderService.new(@order).call
|
||||
|
||||
@order.shipments.map &:refresh_rates
|
||||
flash[:success] = Spree.t('customer_details_updated')
|
||||
|
||||
@@ -39,6 +39,14 @@ describe Spree::Admin::Orders::CustomerDetailsController, type: :controller do
|
||||
login_as_enterprise_user [order.distributor]
|
||||
end
|
||||
|
||||
it "advances the order state" do
|
||||
expect {
|
||||
spree_post :update, order: { email: user.email, bill_address_attributes: address_params,
|
||||
ship_address_attributes: address_params },
|
||||
order_id: order.number
|
||||
}.to change { order.reload.state }.from("cart").to("complete")
|
||||
end
|
||||
|
||||
context "when adding details of a registered user" do
|
||||
it "redirects to shipments on success" do
|
||||
spree_post :update, order: { email: user.email, bill_address_attributes: address_params, ship_address_attributes: address_params }, order_id: order.number
|
||||
|
||||
Reference in New Issue
Block a user