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.
You're missing the VCR setup. You can see that here:
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.
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' |
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' |
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.
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.
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. |
CheezItMan
left a comment
There was a problem hiding this comment.
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.
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.
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