Skip to content

Commit

Permalink
[Boutique Inventory] Counts all stock that exists
Browse files Browse the repository at this point in the history
This corrects a bug that would not account for all items in some
inventory that would otherwise pass the tests.
  • Loading branch information
sciberboy authored and kotp committed Nov 30, 2022
1 parent 7dd1d18 commit 6ba9260
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,12 @@ def test_total_stock_for_some_items
items = [shoes, coat, handkerchief]
assert_equal 5, BoutiqueInventory.new(items).total_stock
end

def test_total_stock_for_all_items
shoes = { price: 30.00, name: "Shoes", quantity_by_size: { s: 1, xl: 4 } }
coat = { price: 65.00, name: "Coat", quantity_by_size: { s: 0, m: 3, l: 0 } }
handkerchief = { price: 19.99, name: "Handkerchief", quantity_by_size: { adult: 4, child: 3 } }
items = [shoes, coat, handkerchief]
assert_equal 15, BoutiqueInventory.new(items).total_stock
end
end

0 comments on commit 6ba9260

Please sign in to comment.