-
Notifications
You must be signed in to change notification settings - Fork 47
API Muncher - Divya #34
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
base: master
Are you sure you want to change the base?
Conversation
API MuncherWhat We're Looking For
|
| def self.search_recipes(query) | ||
| url = BASE_URL + "?q=#{query}" + "&app_id=#{ID}" + "&app_key=#{KEY}" + "&from=0" + "&to=50" | ||
| response = HTTParty.get(url) | ||
| raise_on_error(response) |
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.
If you're going to raise an error here, your controller would need to rescue the error.
| it "succeeds with illogical input" do | ||
| VCR.use_cassette('recipes') do | ||
|
|
||
| get recipes_path, params: {query: "qwerty"} |
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.
You should also test with nonsense like $%^ or nil
| @@ -0,0 +1,82 @@ | |||
| require 'test_helper' | |||
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.
Your edamam_wrapper_test is testing Recipe instead of the wrapper.
CheezItMan
left a comment
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.
Better, I can still crash your heroku instance by typing *&^ in the search bar.
| gem 'will_paginate', '~> 3.1.6' | ||
| gem 'httparty' | ||
|
|
||
| gem 'kaminari' |
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.
Why both gems?
|
|
||
| it "raises StandardError for a bad recipe id" do | ||
| VCR.use_cassette('recipes') do | ||
| proc { EdamamWrapper.get_recipe(0000) }.must_raise |
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.
You should use expect instead of proc, that behavior is old-minitest and will be depreciated in the next version.
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)?