Reimplement checkout item removal. All existing tests now pass

This commit is contained in:
David Underwood
2026-07-21 12:49:57 -04:00
parent 60d132a821
commit f220a1691c
3 changed files with 50 additions and 39 deletions
+4
View File
@@ -16,6 +16,10 @@ class ProductInCheckout
@quantity += quantity
end
def remove_quantity(quantity)
@quantity = [@quantity - quantity, 0].max
end
def total
(@product.price * quantity) - @product.discount.discount_for_quantity(@quantity)
end