Skip to content

Luke's takeaway challenge pull request - #2224

Open
lukestorey95 wants to merge 23 commits into
makersacademy:mainfrom
lukestorey95:main
Open

Luke's takeaway challenge pull request#2224
lukestorey95 wants to merge 23 commits into
makersacademy:mainfrom
lukestorey95:main

Conversation

@lukestorey95

Copy link
Copy Markdown

Your name

Luke Storey

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!

@lukestorey95 lukestorey95 changed the title Takeaway challenge pull request Luke's takeaway challenge pull request May 2, 2022

@SamButton12 SamButton12 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Luke, very nicely organised and readable code throughout. I've tried to pose some questions, but I suggest reading through the review with your own code in mind as well as having Eoin take a look. Great effort this weekend though!

Comment thread README.md
4. Write the minimum code to make test pass
5. Refactor and ensure tests still pass
6. Repeat step 2 and ensure behaviour works as intended

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like your readme. It sets a tone for the rest of the code.

Comment thread spec/integration_spec.rb
@@ -0,0 +1,11 @@
describe 'integration test' do
xit 'should not raise error' do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you have written about future features/testing and any unused tests in the readme?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For an integration or feature test, you could execute the methods to replicate a full user journey - placing an order and confirming the order total.

Comment thread spec/order_spec.rb
subject(:order) { Order.new }
dishes = [{ pizza: 9.50 }, { pasta: 8.20 }]

describe '#add_to_basket' do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really easy to read Rspec describe and context blocks, well done

Comment thread lib/order.rb
end

def order_complete?
fail "Order already completed!" if complete_status == true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the differences of using raise in this situation?

Comment thread lib/takeaway.rb
@@ -0,0 +1,46 @@
class Takeaway

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very easy to read, all method operations encapsulated into private methods.

@eoinmakers eoinmakers left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great implementation of the Takeaway challenge - you've clearly demonstrated the learning objectives of the week. Nice work!

There are places in which the implementation is maybe on the more complex side - ie. the use of a CSV file and whether or not a dish is available, but it's not more complex by a large margin, and I think it can be nice to experiment with things like CSVs. in weekend challenges. In tech tests, close adherence to the exact spec is a priority.

You demonstrate a wide array of unit tests particularly in your Takeaway spec - and I left a comment around the integration test currently included.

Nice work!

Comment thread lib/menu.rb
end
end

def true?(available)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend adding more context to this method name, eg. is_available? rather than just true?

Comment thread lib/menu.rb

def filter_dishes_by_available
self.available_dishes = dishes.select do |dish|
dish[:available] == true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functionality around whether a dish is available or not is adding a slight degree of complexity that isn't asked for in the spec - do try to keep your implementation as simple as possible by following the spec closely. I think the 'available'ness mentioned in the user story simply refers to dishes that are on sale at the restaurant.

Comment thread spec/integration_spec.rb
@@ -0,0 +1,11 @@
describe 'integration test' do
xit 'should not raise error' do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For an integration or feature test, you could execute the methods to replicate a full user journey - placing an order and confirming the order total.

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.

3 participants