Skip to content
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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Steven Spiegl #2230

wants to merge 15 commits into from

Conversation

S-Spiegl
Copy link

@S-Spiegl S-Spiegl commented May 2, 2022

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).

  • User story 1: "I would like to see a list of dishes with prices"
  • User story 2: "I would like to be able to select some number of several available dishes"
  • User story 3: "I would like to check that the total I have been given matches the sum of the various dishes in my order"
  • User story 4: "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"

README checklist

Does your README contains instructions for

  • how to install,
  • how to run,
  • and how to test your code?

Here is a pill that can help you write a great README!

Copy link

@eoinmakers eoinmakers left a 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

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

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
Copy link
Author

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

Copy link
Author

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...
Copy link
Author

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

Copy link
Author

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

Copy link
Author

@S-Spiegl S-Spiegl May 11, 2022

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants