Created
February 1, 2024 01:02
-
-
Save theRealNG/59d51b0d3a921a347bdc57da97178a2d to your computer and use it in GitHub Desktop.
Shopping Cart Test case using MiniTests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShoppingCartTest < MiniTest::Test | |
def setup | |
@cart = ShoppingCart.new | |
end | |
def test_calculates_total_price_with_taxes | |
item = Item.new("Apple", 10.00) | |
# Stubbing the add_item method | |
@cart.stub(:add_item, nil) do | |
@cart.add_item(item) | |
assert_equal 11.50, @cart.total_price_with_taxes | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment