API Muncher - Angela - Octos#31
Open
knockknockhusthere wants to merge 24 commits intoAda-C9:masterfrom
Open
Conversation
API MuncherWhat We're Looking For
|
droberts-sea
reviewed
May 7, 2018
|
|
||
| get '/recipes', to: 'recipes#index', as: 'recipes' | ||
|
|
||
| get '/recipes/:label', to: 'recipes#show', as: "recipe" |
There was a problem hiding this comment.
Could you use resources :recipes, only: [:index, :show] here?
|
|
||
| if uri.nil? || uri.empty? | ||
| raise ArgumentError.new("Need a recipe uri pls") | ||
| end |
There was a problem hiding this comment.
Good work validating only things that will break your app if they're not there.
| def self.raise_on_error(response) | ||
| unless response["count"] | ||
| raise RecipeError.new(response["error"]) | ||
| end |
There was a problem hiding this comment.
This method is never called! Please don't copy-paste code without understanding how it fits together.
| # ALWAYS CHECK YOUR ERROR CODES | ||
| # unless response.success? | ||
| # raise StandardError.new(response["error"]) | ||
| # end |
There was a problem hiding this comment.
# ALWAYS CHECK YOUR ERROR CODES
ಠ_ಠ
|
|
||
| it "displays the recipe page for the selected recipe" do | ||
| VCR.use_cassette("recipe") do | ||
| uri = "http://www.edamam.com/ontologies/edamam.owl#recipe_e427aa9f6e7a96ecadbf994d9f75fd14" |
| describe 'index' do | ||
| it "returns a list of search recipes results" do | ||
| query = "chicken" | ||
| VCR.use_cassette("recipes") do |
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 there are no paging parameters provided?
- What if the paging parameters are invalid (negative number, etc)?
- What if the paging parameters take you past the end of the available search results?
|
|
||
| it "can't give a list of recipes" do | ||
| VCR.use_cassette("recipes") do | ||
| recipe = RecipeApiWrapper.list_recipes("jdns2n") |
There was a problem hiding this comment.
You need some tests for show here! I would be interested in at least what happens when for a good vs bad uri.
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