Logic for adding items and validating them
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
require "minitest/autorun"
|
||||
|
||||
require "./checkout.rb"
|
||||
|
||||
class TestCheckout < Minitest::Test
|
||||
def setup
|
||||
@checkout = Checkout.new
|
||||
end
|
||||
|
||||
def test_that_unknown_items_cannot_be_added
|
||||
assert_raises Checkout::InvalidItem do
|
||||
@checkout.add(:foo)
|
||||
end
|
||||
end
|
||||
|
||||
def test_that_allowed_items_are_added
|
||||
@checkout.add(:PI5)
|
||||
@checkout.add(:ZERO2W)
|
||||
|
||||
assert_equal [:PI5, :ZERO2W].sort, @checkout.items.sort
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user