Ampers: Angela Poland#21
Open
AngelaPoland wants to merge 21 commits into
Open
Conversation
…hen I put puts statments in the if/else loop its in...both are printing out and I don't know why. (even though the test technically passes in specs test
…ere/ran out of time to figure it out.
…ethod test. did not finish.
…able to get csv file to get imported.
…t updated the first wave 1 test for it though.
…supposed to work.
… did in order specs that are easier to adjust for online-orders.
Grocery StoreWhat We're Looking For
|
CheezItMan
reviewed
Feb 22, 2018
|
|
||
| class OnlineOrder < Order | ||
|
|
||
| attr_reader :id, :products, :customer_id, :fulfillment_status |
There was a problem hiding this comment.
You can inherit the helper methods for id and products and just have:
attr_reader :customer_id, :fulfillment_status| attr_reader :id, :products, :customer_id, :fulfillment_status | ||
|
|
||
| def initialize(id, products, customer_id, fulfillment_status) | ||
| @id = id |
There was a problem hiding this comment.
You should have:
super(id, products)here to initialize @id and @products
| # tip from Katie: 16 and 22 are the customer id's that exsit but do not have orders | ||
| end | ||
|
|
||
| def self.all |
| def self.find_by_customer(customer_id) | ||
|
|
||
| OnlineOrder.all.each do |single_order| | ||
| order_list = [] |
There was a problem hiding this comment.
You should probably have order_list = [] outside the loop.
| end | ||
| end | ||
|
|
||
| def total |
| # TODO: Your test code here! | ||
| end | ||
| xdescribe "OnlineOrder.find_by_customer" do | ||
| xit "Returns an array of online orders for a specific customer ID" do |
There was a problem hiding this comment.
This should return an array, so:
Grocery::OnlineOrder.find(1).must_be_instance_of Array
Grocery::OnlineOrder.find(1).each do |element|
element.must_be_instance_of Grocery::OnlineOrder
end| # Act | ||
| order.add_product("salad", 4.25) | ||
|
|
||
| # Assert |
There was a problem hiding this comment.
Smart to put these comments in to see the steps.
| all_orders.class.must_equal Array | ||
|
|
||
| all_orders.each do |order| | ||
| order.must_be_instance_of Grocery::Order |
| describe "Order.find" do | ||
|
|
||
| before do | ||
| @order_class = Grocery::Order |
There was a problem hiding this comment.
Not sure what the point of this is, just to save typing?
| it "Can find the first order from the CSV" do | ||
| # TODO: Your test code here! | ||
|
|
||
| @order_class.find(1).must_be_instance_of Grocery::Order |
There was a problem hiding this comment.
You should also check to ensure the values of the found Order have the right values, check the id, products etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Grocery Store
Congratulations! You're submitting your assignment.
Comprehension Questions
raise ArgumentError?.all&.findmethods class methods? Why not instance methods?