Conversation
API MuncherWhat We're Looking For
|
dHelmgren
reviewed
Nov 14, 2018
| Rails.application.routes.draw do | ||
| root "recipes#index" | ||
| get 'recipes/index', to: "recipes#index", as: "list_recipes" | ||
| get 'recipes/show/:find', to: "recipes#show", as: "show_recipe" |
There was a problem hiding this comment.
Could you use resources for the index and show pages?
| api_params["ingredientLines"], | ||
| api_params["healthLabels"], | ||
| api_params["cautions"] | ||
| ) |
There was a problem hiding this comment.
Is there a way to merge show_recipe and create_recipe?
| def show | ||
| if params[:find] | ||
| @find = params[:find] | ||
| @recipe = EdamamApiWrapper.find_recipe(@find) |
There was a problem hiding this comment.
You've written your API wrapper to raise an error if the API call fails, but you're not looking for an error here. You should wrap this call in a begin/rescue.
Not doing so affects your ability to catch fail states and properly redirect the user.
| http_interactions: | ||
| - request: | ||
| method: get | ||
| uri: https://api.edamam.com/search?app_id=<MUNCHER_TOKEN>&app_key=04c236eb15ab0bae3dd07c08766aa823&r=http://www.edamam.com/ontologies/edamam.owl%23recipe_7bf4a371c6884d809682a72808da7dc2 |
| it "should get home" do | ||
| # make test to | ||
| get root_path | ||
| value(response).must_be :successful? |
There was a problem hiding this comment.
There are some interesting cases you're not covering here:
- What happens if no search term is provided?
- What if the search returns no results?
It might also be worthwhile to add some tests around the paging parameters:
- What happens if they're absent?
- Do you get different results when they change?
- What if you send a bogus value, like a negative page number?
|
|
||
| it 'can find recipe given a valid path' do | ||
| VCR.use_cassette('find_valid') do | ||
| find = "http://www.edamam.com/ontologies/edamam.owl#recipe_7bf4a371c6884d809682a72808da7dc2" |
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.
API Muncher
Congratulations! You're submitting your assignment!
Comprehension Questions
lib? How would your project change if you needed to interact with more than one API (aka more than just the Edamam API)?