From 6ba9260aed86d85a3aab2415332f8e612f174f6c Mon Sep 17 00:00:00 2001 From: stephan-sciberboy Date: Wed, 30 Nov 2022 14:18:29 -0500 Subject: [PATCH] [Boutique Inventory] Counts all stock that exists This corrects a bug that would not account for all items in some inventory that would otherwise pass the tests. --- .../concept/boutique-inventory/boutique_inventory_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/exercises/concept/boutique-inventory/boutique_inventory_test.rb b/exercises/concept/boutique-inventory/boutique_inventory_test.rb index 1de35af31e..2898da92f1 100644 --- a/exercises/concept/boutique-inventory/boutique_inventory_test.rb +++ b/exercises/concept/boutique-inventory/boutique_inventory_test.rb @@ -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