-
Notifications
You must be signed in to change notification settings - Fork 42
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
Stef -- Carets #27
base: master
Are you sure you want to change the base?
Stef -- Carets #27
Conversation
…s, and added recipe file to lib and updated.
…to testing, and updated.
…llenge evidently...
…ome page and add search bar across all pages.
…eceiving this error, but wrote tests.
test/test_helper.rb
Outdated
@@ -0,0 +1,9 @@ | |||
require File.expand_path('../../config/environment', __FILE__) | |||
require 'rails/test_help' |
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're missing the VCR setup. You can see that here:
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.
Thank you! Sorted that!
API MuncherWhat We're Looking For
|
recipe.ingredients.must_equal "ingredients" | ||
recipe.dietary.must_equal "dietary" | ||
recipe.link.must_equal "link" | ||
end |
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 also add a test to verify any required fields. Basically a negative test for the initialize
method.
|
||
group :test do | ||
gem 'minitest-rails' | ||
gem 'minitest-reporters' |
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.
Also missing VCR and webmock
test/lib/edamam_api_wrapper_test.rb
Outdated
VCR.use_cassette("recipes") do | ||
good_uri = "https://api.edamam.com/search?r=http://www.edamam.com/ontologies/edamam.owl%23recipe_c23d4d64e02318eef70940c6643353ad" | ||
recipe = EdamamApiWrapper.show_recipe(good_uri) | ||
recipe.label.must_equal 'Pimento Cheese' |
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.
No field called label
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 took a look at things again, you've got some running tests now, but many are throwing errors or failing. Just some cleanup work to do there. I also updated my feedback above.
lib/edamam_api_wrapper.rb
Outdated
|
||
url = BASE_URL + "r=" + RECIPE_URL + (recipe_uri) | ||
|
||
data = HTTParty.get(url) |
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 probably need a test to see if data is nil, or data[0] is nil before trying to create a recipe object.
it "Shows a recipe page for a recipe." do | ||
VCR.use_cassette("recipes") do | ||
recipe = "https://api.edamam.com/search?r=http://www.edamam.com/ontologies/edamam.owl%23recipe_c23d4d64e02318eef70940c6643353ad" | ||
get recipe_path(uri: recipe) |
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.
This should probably be something like this:
get recipe_path(recipe)
But I think the above URI is wrong.
Tests now passing completely, with a few more added tests. |
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.
Really good, now the focus needs to be on VideoStore and crafting an API, and over the weekend reading up on JavaScript
describe EdamamApiWrapper do | ||
|
||
describe "self.list_recipes" do | ||
it "Can get recipes with a search word." 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.
The only other thing for this would be verifying that each element of the array is a Recipe. Otherwise really good.
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.
We did get our project done for VideoStore and turned it in this afternoon. I'm working on JS now. :) . Thank you for the feedback, I really appreciate it.
API Muncher
Congratulations! You're submitting your assignment!
Comprehension Questions