-
Notifications
You must be signed in to change notification settings - Fork 47
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
samjo's recipe-muncher #32
base: master
Are you sure you want to change the base?
Conversation
…ng too many at once
API MuncherWhat We're Looking For
|
get "/auth/:provider/callback", to: "sessions#create", as: 'auth_callback' | ||
delete "/logout", to: "sessions#destroy", as: "logout" | ||
|
||
resources :recipe_searches, only: [:index, :show] |
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.
Nice work setting these with resources
attr_reader :label, :recipe_uri, :source, :source_uri, :ingredient_lines, | ||
:image_uri, :recipe_yield, :total_time, :health_labels | ||
|
||
REQUIRED_ARGS = [:label, :recipe_uri, :source, :source_uri, :ingredient_lines] |
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.
I would say you're over-validating here. In general, you should only validate fields that will cause your app to break if they're not there. In this case, that's label
, uri
and possibly image
. Anything beyond that is an unnecessary dependency on the data coming from the API and is an extra thing for you to test.
recorded_at: Wed, 31 Oct 2018 22:22:23 GMT | ||
- request: | ||
method: get | ||
uri: https://api.edamam.com/search?app_id=<EDAMAM_APP_ID>&app_key=<EDAMAM_APP_KEY>&r=http://www.edamam.com/ontologies/edamam.owl%23bogus! |
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.
yay!
|
||
describe FavoritesController do | ||
it "should get index" do | ||
get favorites_path |
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.
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?
Just FYI, Your pagination breaks if I give it a negative page.
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)?Trello: https://trello.com/b/HL0gtltd/sj-api-muncher
See Trello for what remains to be done. I'm not finished with testing, but a lot of what's left is testing that I've practiced with MR-R and bEtsy. While TDD is a good practice, for this project I decided to prioritize learning new skills, like OAuth Google and filtering search results.