build a cashier function that adds products to a cart and displays the total price.
Thinking about the problem led to sketching the domain model.
Following the diagram I created four classes each having it's own responsibility. Along side I created a test spec file for each class.
What followed was a TDD approach in which I wrote each test first and then wrote the code to make the test pass.
clone the repo and run bundle install
in the terminal run
pry -r ./lib/checkout.rb
co = Checkout.new
green_tea = Item.new('green tea', 10, 'GR1')
co.scan(green_tea)
co.total
bundle exec rspec --color