Return the cancelled order explicitly

This commit is contained in:
Tim Kächele 2024-01-21 19:00:17 +01:00
parent cd2262e895
commit dd441df8ff
2 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,7 @@ module Rex
end
order_ids.delete(order.id)
order
end
alias_method :cancel_order, :remove_order

View File

@ -109,6 +109,12 @@ RSpec.describe Rex::Book::LimitOrderBook do
instance.add_order(buy_order)
end
it "returns the cancelled order" do
order = instance.cancel_order(buy_order.id)
expect(order).to eq(buy_order)
end
context "when the order id is unknown" do
it "returns nil" do
expect(instance.cancel_order(-1)).to eq(nil)