mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Spec trying to ready a shipment twice
This commit is contained in:
committed by
Neal Chambers
parent
b0bb97a22f
commit
c439aaf32f
@@ -102,6 +102,17 @@ describe Api::V0::ShipmentsController, type: :controller do
|
||||
expect(shipment.reload.state).to eq("ready")
|
||||
end
|
||||
|
||||
it "checks if shipment is ready already" do
|
||||
allow_any_instance_of(Spree::Order).to receive_messages(paid?: true, complete?: true)
|
||||
shipment.ready!
|
||||
|
||||
api_put :ready, order_id: shipment.order.to_param, id: shipment.to_param
|
||||
|
||||
expect(attributes.all?{ |attr| json_response.key? attr.to_s }).to be_truthy
|
||||
expect(json_response["state"]).to eq("ready")
|
||||
expect(shipment.reload.state).to eq("ready")
|
||||
end
|
||||
|
||||
it "cannot make a shipment ready if the order is unpaid" do
|
||||
allow_any_instance_of(Spree::Order).to receive_messages(paid?: false)
|
||||
api_put :ready, order_id: shipment.order.to_param, id: shipment.to_param
|
||||
|
||||
Reference in New Issue
Block a user