_________
r== | |
_ // | M.A. | ))))
|_)//(''''': | |
// \_____:_____.-------D )))))
// | === | / \
.:'//. \ \=| \ / .:'':./ )))))
:' // ': \ \ ''..'--:'-.. ':
'. '' .' \:.....:--'.-'' .'
':..:' ':..:'
This program simulates ordering food from a takeaway. Orders are made from a menu, and orders are confirmed by text message using Twilio. The program is written and tested in Ruby. Doubles/mocking are used to avoid sending SMS messages during testing.
- If a customer would like to see a list of dishes with prices:
2.4.1 :001 > require './lib/takeaway'
=> true
2.4.1 :002 > takeaway = Takeaway.new
2.4.1 :003 > takeaway.read_menu
=> {"Fish and chips"=>7, "Burger"=>8, "Kebab"=>10, "Pizza"=>12}
- If the customer would like to be able to select some available dishes:
2.4.1 :004 > takeaway.select_dish('burger', 2)
=> 2
2.4.1 :005 > takeaway.select_dish('pizza', 1)
=> 1
- If the customer would like to check the sum of total and see the order
2.4.1 :006 > takeaway.show_order
1. 2x Burger, £8
2. 1x Pizza, £12
Total: £28
=> nil
- Confirm the order with the customer, they enter the total value of the order to place it. The customer then receives a text similar to "Thank you! Your order will be delivered before 19:15"
2.4.1 :007 > takeaway.place_order(28)
SM050dc5c783954e2796a5fc58626cdd9a
=> nil
- Ruby 2.4.1
- RSpec
- twilio-ruby
As a customer
So that I can check if I want to order something
I would like to see a list of dishes with prices
As a customer
So that I can order the meal I want
I would like to be able to select some number of several available dishes
As a customer
So that I can verify that my order is correct
I would like to check that the total I have been given matches the sum of the various dishes in my order
As a customer
So that I am reassured that my order will be delivered on time
I would like to receive a text such as "Thank you! Your order was placed and will be delivered before 18:52" after I have ordered