mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Spec stock bug when changing canceled orders
We decided to disallow changing canceled orders in a way that would affect stock or totals.
This commit is contained in:
@@ -154,6 +154,30 @@ describe Api::V0::ShipmentsController, type: :controller do
|
||||
}.to change { existing_variant.reload.on_hand }.by(2)
|
||||
end
|
||||
end
|
||||
|
||||
context "for canceled orders" do
|
||||
before do
|
||||
expect(order.cancel).to eq true
|
||||
end
|
||||
|
||||
it "doesn't adjusts stock when adding a variant" do
|
||||
pending "https://github.com/openfoodfoundation/openfoodnetwork/issues/7166"
|
||||
|
||||
expect {
|
||||
api_put :add, params.merge(variant_id: existing_variant.to_param)
|
||||
expect(response.status).to eq(422)
|
||||
}.to_not change { existing_variant.reload.on_hand }
|
||||
end
|
||||
|
||||
it "doesn't adjusts stock when removing a variant" do
|
||||
pending "https://github.com/openfoodfoundation/openfoodnetwork/issues/7166"
|
||||
|
||||
expect {
|
||||
api_put :remove, params.merge(variant_id: existing_variant.to_param)
|
||||
expect(response.status).to eq(422)
|
||||
}.to_not change { existing_variant.reload.on_hand }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "can transition a shipment from ready to ship" do
|
||||
|
||||
Reference in New Issue
Block a user