diff --git a/lib/menu.rb b/lib/menu.rb new file mode 100644 index 0000000000..20e9cec658 --- /dev/null +++ b/lib/menu.rb @@ -0,0 +1,15 @@ +class Menu +attr_reader :dishes + + def initialize + @dishes = [ + {pomodoro: 10}, + {vongole: 13.50}, + {carbonara: 12}, + {amaracitiana: 11} + + ] + + end + +end \ No newline at end of file diff --git a/lib/order.rb b/lib/order.rb new file mode 100644 index 0000000000..58b3c8fcb8 --- /dev/null +++ b/lib/order.rb @@ -0,0 +1,11 @@ +class Order + + def initialize(menu = Menu.new) + @menu = menu + end + + def choose_item(item) + end + + +end \ No newline at end of file diff --git a/myREADME.md b/myREADME.md new file mode 100644 index 0000000000..26cb53d79c --- /dev/null +++ b/myREADME.md @@ -0,0 +1,35 @@ +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 + +Ensure you have a list of dishes with prices +- The text should state that the order was placed successfully and that it will be delivered 1 hour from now, e.g. "Thank you! Your order was placed and will be delivered before 18:52". +- The text sending functionality should be implemented using Twilio API. You'll need to register for it. It’s free. +- Use the twilio-ruby gem to access the API +- Use the Gemfile to manage your gems +- Make sure that your Takeaway is thoroughly tested and that you use mocks and/or stubs, as necessary to not to send texts when your tests are run +- However, if your Takeaway is loaded into IRB and the order is placed, the text should actually be sent +- Note that you can only send texts in the same country as you have your account. I.e. if you have a UK account you can only send to UK numbers. + +Plan + - Get twilio API + - Identify classes + - Write tests for each class and get them green + - Refactor + + Classes + - Menu + - Order + - Text diff --git a/spec/menu_spec.rb b/spec/menu_spec.rb new file mode 100644 index 0000000000..e7367322e1 --- /dev/null +++ b/spec/menu_spec.rb @@ -0,0 +1,7 @@ +require 'menu' + +describe Menu do + it 'can display list of available items' do + expect(subject.dishes).to include({pomodoro: 10}) + end +end \ No newline at end of file diff --git a/spec/order_spec.rb b/spec/order_spec.rb new file mode 100644 index 0000000000..5e637d6f2d --- /dev/null +++ b/spec/order_spec.rb @@ -0,0 +1,14 @@ +require 'order' + +describe Order do + + it 'can respond to choose items' do + expect(subject).to respond_to(:choose_item) + end + + it 'can choose items from the menu' do + expect(subject.choose_item(item,quantity)).to eq[{carbonara: 19}] + end + + +end