mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-19 00:27:25 +00:00
Adding spec for case when standing_order_orders aren't linked to an order cycle
This should never happen, but came up in specs
This commit is contained in:
@@ -17,10 +17,10 @@ class StandingOrderOrder < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def cancel
|
||||
return false unless order.order_cycle.orders_close_at > Time.zone.now
|
||||
return false unless order.order_cycle.andand.orders_close_at.andand > Time.zone.now
|
||||
transaction do
|
||||
self.update_column(:cancelled_at, Time.zone.now)
|
||||
order.send('cancel') if order.complete?
|
||||
order.send('cancel')
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user