-
Notifications
You must be signed in to change notification settings - Fork 45
Selam Grocery Store Assignment #45
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
base: master
Are you sure you want to change the base?
Conversation
…cery order including tax, and allow user to add a product with boolean to confirm addition
…es and an array of store ID, then stores into an array of objects. Included self.find() - checks user input for store ID and returns associated object or NIL.
…readability and class functions
…clude shipping fee, overrode add_product to raise argument error, added self.all to read in from CSV, and self.find to find object by ID.
Grocery StoreWhat We're Looking For
Selam!!!!! Your indentation!!!!! Is off in so many places!!!!!!! Selam!!!!!! Please take care to adjust your indentation as you work You have one test that's red: OnlineOrder::OnlineOrder.find#test_0001_Will find an online order from the CSV Your class is named You used class variables in your solution-- Good job with Customer, too With regards to your tests: I think you did a good job of writing them! They're pretty clear and good. A few of them could be more specific; for instance, your Also, a lot of the tests were missing and you didn't do them. They were especially the kinds of tests that were a little bit more deep and you had to check data more deeply. I think you need practice writing tests that are more deep than just checking to make sure IDs exist, etc, so I look forward to the future where you'll submit some good tests In general, good job; half of the OnlineOrder tests are missing and I think there are some detailed things about your code to work on, but overall you hit some of the requirements well |
| # TODO: Your test code here! | ||
| online_orders = Onlineorder.all | ||
| searched = online_orders.find('45') | ||
| searched.id.must_equal '45' |
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 get an error when running this test-- this test isn't written correctly. Why though?
the error is searched doesn't have a method .id. What is the value of searched?
The value of searched isn't an instance of OnlineOrder, which is what we expected. It's an instance of Enumerator. Why?
You set searched to the value of online_orders.find('45'). online_orders is an array of OnlineOrder instances. Therefore, Ruby calls on Array's implementation of .find.
If you want to use the .find method you defined as a class method off of OnlineOrder, you're going to need to call it with the correct syntax: Grocery::OnlineOrder.find('45')
Grocery Store
Congratulations! You're submitting your assignment.
Comprehension Questions
raise ArgumentError?.all&.findmethods class methods? Why not instance methods?