-
Notifications
You must be signed in to change notification settings - Fork 44
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
ampersands - Mariko #47
base: master
Are you sure you want to change the base?
Conversation
API MuncherWhat We're Looking For
|
|
||
response = HTTParty.get(encoded_uri) | ||
|
||
if !response.nil? |
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.
To make the skipped test pass you need to check to see if response has any elements, so
if !response.nil? && response.length > 0
it "should get a list of recpies" do | ||
VCR.use_cassette("muncher") do | ||
get recipe_results_path | ||
recipes = EdamamApiWrapper.list_recipes("Nooch") |
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 are you mixing using the Wrapper in the controller test. In this file you should only be testing the controller.
Instead this test should look like:
it "should get a list of recpies" do
VCR.use_cassette("muncher") do
get recipe_results_path, params: {q: "Nooch"}
end
must_respond_with :ok
end
flash[:message] = "Sorry, We couldn't find any matching recipes" | ||
redirect_to root_path | ||
else | ||
@results = Kaminari.paginate_array(EdamamApiWrapper.list_recipes(search_term)).page(params[:page]).per(10) |
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 have a test responding with :found instead of :ok, but your controller is only responding with :ok
it "redirects to root_path for empty search" do | ||
VCR.use_cassette("muncher") do | ||
get recipe_results_path | ||
EdamamApiWrapper.list_recipes("") |
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.
Again, this shouldn't be in the test case, instead just have the get request
get recipe_results_path, params: {q: ""}
end | ||
|
||
describe "show" do | ||
it "succeeds with for vaid recipe" do |
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 also need a negative case.
API Muncher
Congratulations! You're submitting your assignment!
Comprehension Questions