Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
@BJHunnicutt Nice work on this project. Very cleanly written and it executes well. I left a few notes in your code, but overall, very impressive.
| @nutrition_info = @recipe.nutrition_info | ||
| end | ||
|
|
||
| def get_total(recipes) |
There was a problem hiding this comment.
get_total should be private if it's an internal helper method.
| end | ||
| return recipes | ||
| else | ||
| return nil |
There was a problem hiding this comment.
Good handling of getting an unexpected response.
|
|
||
| url = BASE_URL + "search?app_id=#{EDAMAM_ID}" + "&app_key=#{EDAMAM_KEY}" + "&q=#{search_term}" | ||
|
|
||
| data = HTTParty.get(url) |
There was a problem hiding this comment.
Just to confirm when you use this you'll end up making 2 API calls, that is a bit of a performance penalty. You might think down-the-road about what you could do to optimize the app.
|
|
||
| if name == nil || id == nil || name == "" || id == "" | ||
| raise ArgumentError | ||
| end |
There was a problem hiding this comment.
Good work requiring necessary fields.
| assert_equal @controller.params[:to], 24 | ||
| assert_not_equal @controller.instance_variable_get(:@total), 14 #14 is what the api says it is | ||
| assert_equal @controller.instance_variable_get(:@total), 12 #12 is what the number of actual recipes returned (only knows this when the last set of recepes is delivered) | ||
|
|
There was a problem hiding this comment.
Good work using ap to figure out what you can do to test the instance variables.
| end | ||
| end | ||
|
|
||
| end |
There was a problem hiding this comment.
You should also probably test the negative case and make sure that you handle cases where the search request or the show page is invalid.
No description provided.