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

Luke's takeaway challenge pull request #2224

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

Conversation

lukestorey95
Copy link

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

@SamButton12 SamButton12 left a comment

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!

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

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.

@@ -0,0 +1,11 @@
describe 'integration test' do
xit 'should not raise error' do

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?

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.

subject(:order) { Order.new }
dishes = [{ pizza: 9.50 }, { pasta: 8.20 }]

describe '#add_to_basket' do

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

end

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

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?

@@ -0,0 +1,46 @@
class Takeaway

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.

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

end
end

def true?(available)

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?


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

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.

@@ -0,0 +1,11 @@
describe 'integration test' do
xit 'should not raise error' do

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.

None yet

3 participants