mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
This ensures we can still use Order#shipment although Spree deprecates it, while fixing a bug at the same time. The problem that was making the test fail was on `Order#shipment` that Spree defines. If the shipments association changes, `#shipment` returns stale data. That is because the order object we might be using is still alive, and so its @shipment ivar still holds an old shipment object (it's not nil) and thus `@shipment ||= shipments.last` doesn't evaluate the right-hand side of the expression. Note that we need to `prepend` the evaluation of the concern (which it's been rename) for our methods to take precedence over Spree ones. With `include`, Spree's `#shipment` would still be picked up making the test fail.