-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Takeaway Challenge (partial) #2240
Open
GeorgeDainton
wants to merge
2
commits into
makersacademy:main
Choose a base branch
from
GeorgeDainton:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class Menu | ||
attr_reader :dishes | ||
|
||
def initialize | ||
@dishes = [ | ||
{pomodoro: 10}, | ||
{vongole: 13.50}, | ||
{carbonara: 12}, | ||
{amaracitiana: 11} | ||
|
||
] | ||
|
||
end | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Order | ||
|
||
def initialize(menu = Menu.new) | ||
@menu = menu | ||
end | ||
|
||
def choose_item(item) | ||
end | ||
|
||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(menu = Menu.new)
may not need to be there, on the next line you could have@menu = Menu.new