Skip to content

Commit dd240f4

Browse files
sciberboykotp
authored andcommitted
[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.
1 parent fa35ccc commit dd240f4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

exercises/concept/boutique-inventory/boutique_inventory_test.rb

+8
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,12 @@ def test_total_stock_for_some_items
112112
items = [shoes, coat, handkerchief]
113113
assert_equal 5, BoutiqueInventory.new(items).total_stock
114114
end
115+
116+
def test_total_stock_for_all_items
117+
shoes = { price: 30.00, name: "Shoes", quantity_by_size: { s: 1, xl: 4 } }
118+
coat = { price: 65.00, name: "Coat", quantity_by_size: { s: 0, m: 3, l: 0 } }
119+
handkerchief = { price: 19.99, name: "Handkerchief", quantity_by_size: { adult: 4, child: 3 } }
120+
items = [shoes, coat, handkerchief]
121+
assert_equal 15, BoutiqueInventory.new(items).total_stock
122+
end
115123
end

0 commit comments

Comments
 (0)