-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Steven Spiegl #2230
base: main
Are you sure you want to change the base?
Steven Spiegl #2230
Conversation
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.
This is a cleanly written Takeaway challenge, well done.
I left very minor comments inline, but the objectives have been clearly demonstrated here and the user stories have been achieved.
The unit tests are comprehensive and wide ranging.
Well done.
lib/order.rb
Outdated
end | ||
|
||
def view_menu | ||
Menu.new |
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.
You previously grab the items on line 10, so you could re-use that instance of Menu to print the dishes instead.
"Your total is: £#{@total}. Please use the complete_order function, entering your phone number as an argument, to complete your order" | ||
end | ||
|
||
def item_added_confirmation |
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.
This functionality is not mentioned in the spec. You should try to adhere to the spec as closely as possible so you're not introducing unnecessary complexity to your project.
@selection = [] | ||
@items = Menu.new.items | ||
@items = items | ||
@total = 0 | ||
end | ||
|
||
def view_menu |
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.
Have implemented suggestion to move this to initialize, but have a question:
Which is better? The implemented initialize or the one below?
def initialize(items = Menu.new)
@selection = []
@items = items.items
@total = 0
end
Both seem to get the same results... The first reads more clearly but makes for a longer argument
@@ -33,6 +33,13 @@ def check_order_prompt | |||
"Please check your order against your total:" | |||
end | |||
|
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.
did I understand User Story 3 correctly or did I go overboard?
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'
did I satisfy this condition simply by giving the customer a 'total' method?
lib/menu.rb
Outdated
@@ -13,4 +13,5 @@ def initialize | |||
def view_menu | |||
@items | |||
end | |||
#is this method necessary? Taking it out doesn't break tests... |
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.
is this method necessary? Taking it out doesn't break tests...
spec/sms_spec.rb
Outdated
@@ -28,3 +25,6 @@ | |||
expect(subject.sms_sent_confirmation).to eq('A confirmation message has been sent to the number you provided') | |||
end | |||
end | |||
|
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.
do these tests actually check an sms has been sent, or just that the class acts as though a message has been sent (e.g. changes sent_confirmation)
@@ -48,15 +48,18 @@ | |||
it 'should call the SMS class' do | |||
subject.add(1) | |||
subject.checkout | |||
expect(subject).to respond_to(subject.complete_order).with(SMS.new.send_sms(ENV['MY_PHONE'])) | |||
expect(subject).to respond_to(:complete_order).with(1).argument | |||
end | |||
end | |||
|
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.
how to actually check that complete_order((ENV['MY_PHONE'])) calls SMS.new.send_sms? I realised I was misusing respond_to above and below comment so changed it above, but now all the test does is check that the method takes one argument. I want to implement a test to make sure that when someone enters their phone number it calls the SMS class...
Your name
Please write your full name here to make it easier to find your pull request.
User stories
Please list which user stories you've implemented (delete the ones that don't apply).
README checklist
Does your README contains instructions for
Here is a pill that can help you write a great README!