Ability to clear checkout

This commit is contained in:
David Underwood
2026-07-15 11:20:21 -04:00
parent dabac3d746
commit 257f154897
2 changed files with 17 additions and 0 deletions
+4
View File
@@ -24,6 +24,10 @@ class Checkout
pre_discount_total - current_discount
end
def clear
@items = []
end
private
def valid_item?(item)
+13
View File
@@ -35,6 +35,19 @@ class TestCheckout < Minitest::Test
assert_equal 0.00, @checkout.total
end
def test_that_we_can_empty_the_checkout
@checkout.add(:PI5)
@checkout.add(:ZERO2W)
@checkout.add(:PICO2)
refute_empty @checkout.items
@checkout.clear
assert_empty @checkout.items
end
# Discounts
def test_that_bogof_applied