mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
13221 Add spec for checking flash error is shown when editing a shipped order
This commit is contained in:
@@ -165,7 +165,7 @@ module Spree
|
||||
def refuse_changing_shipped_orders
|
||||
return unless @order.shipped?
|
||||
|
||||
flash[:error] = I18n.t("admin.orders.cannot_add_item_to_shipped_order")
|
||||
flash[:error] = I18n.t("spree.admin.orders.add_product.cannot_add_item_to_shipped_order")
|
||||
redirect_to spree.edit_admin_order_path(@order)
|
||||
end
|
||||
|
||||
|
||||
@@ -226,6 +226,17 @@ RSpec.describe Spree::Admin::OrdersController, type: :controller do
|
||||
end
|
||||
end
|
||||
|
||||
context "when order is shipped" do
|
||||
it "redirects to order details page with flash error" do
|
||||
order.update(shipment_state: :ready)
|
||||
order.update(shipment_state: :shipped)
|
||||
spree_put :update, { id: order }
|
||||
|
||||
expect(flash[:error]).to eq "Cannot add item to shipped order"
|
||||
expect(response).to redirect_to spree.edit_admin_order_path(order)
|
||||
end
|
||||
end
|
||||
|
||||
context "with line items" do
|
||||
let!(:distributor){ create(:distributor_enterprise) }
|
||||
let!(:shipment){ create(:shipment) }
|
||||
|
||||
Reference in New Issue
Block a user