Skip to content
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

Carets- Julia Meier- API Muncher #25

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
43689ef
initial setup. copied lib and lib_test files from previous project. m…
julmeier Nov 1, 2017
b2d35cc
added recipes_controller
julmeier Nov 1, 2017
86dde1e
added config.autoload_paths line to the config/application.rb file
julmeier Nov 1, 2017
b3d54f1
continued testing of edamam_api_wrapper. Found some leftover text aft…
julmeier Nov 1, 2017
17fea3b
created controller methods and made index and search html pages. Was …
julmeier Nov 2, 2017
7b7cb33
made show controller, route and view
julmeier Nov 2, 2017
96a423f
created show_recipe method. modified list_recipes method to take in t…
julmeier Nov 2, 2017
86d29f0
save of number_of_recipes/10 loop in the search view. experimenting w…
julmeier Nov 3, 2017
5d36257
figured out how to pass the from/to parameters to the controller. Abo…
julmeier Nov 3, 2017
a7e2304
some nuggets of wisdom from dee about how to inject from/to into the …
julmeier Nov 3, 2017
48e4dd3
got help from dee to finish with pagination. found out that the API o…
julmeier Nov 3, 2017
b81cdc9
added additional elements to show page. will start to refactor contro…
julmeier Nov 3, 2017
cb93b6f
added logic to search view to display the pagination correctly when t…
julmeier Nov 3, 2017
d9a40cf
additional refactoring
julmeier Nov 3, 2017
8484a07
commented out require stuff at the top of controllers
julmeier Nov 3, 2017
2a57fd1
changed line 12 in search.html to consider nil class based on heroku …
julmeier Nov 3, 2017
dae937d
added required lines to the application.rb and production.rb based on…
julmeier Nov 3, 2017
737276d
changed line 12 in search view to be &&
julmeier Nov 3, 2017
a533fe2
removed the portion of the view page that displays the pagination bec…
julmeier Nov 3, 2017
6e27d54
added back in the pagination view code. Took it out to see if it was …
julmeier Nov 3, 2017
2401968
added require dependency to the API controller too
julmeier Nov 3, 2017
cf5b4c4
added styling to the form and search pages. having issue oissue of wr…
julmeier Nov 5, 2017
f0208ef
continued styling on show and search pages. The Health Information da…
julmeier Nov 5, 2017
2a3f897
can't get the photo captions to wrap
julmeier Nov 5, 2017
a5b9107
fixed columns on the show page so that all content lines up correctly
julmeier Nov 5, 2017
86650bd
heroku is not uploading my background image for the search headers. a…
julmeier Nov 5, 2017
fc33205
removed config.assets.compile = false from production.rb
julmeier Nov 5, 2017
b236ded
finished all required styling
julmeier Nov 5, 2017
823c83a
centered grid on results page. on an xlarge screen, the home page has…
julmeier Nov 5, 2017
3fda7b6
tried to fix gap between footer and image on home page- no go
julmeier Nov 5, 2017
868b12d
changed name to What's Cookin'?
julmeier Nov 5, 2017
d628354
fixed CSS mistakes that were preventing upload to heroku
julmeier Nov 6, 2017
5f1550b
controller testing ongoing. saving because computer is getting blippy
julmeier Nov 6, 2017
f5fe8d5
changed failure case from @keywords.nil? to @keywords.blank? after te…
julmeier Nov 6, 2017
29bbac7
additional controller tests
julmeier Nov 6, 2017
f4f1af7
additional model and controller testing
julmeier Nov 6, 2017
d86e89f
Chris helped me get lib tests to work by recreating postgres. Fixed l…
julmeier Nov 6, 2017
25d67ab
changed CSS body to 100% height which fixed smartphone issues with la…
julmeier Nov 14, 2017
8d869b2
changed footer CSS on results page so that it's fixed to the bottom (…
julmeier Nov 14, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
controller testing ongoing. saving because computer is getting blippy
julmeier committed Nov 6, 2017
commit 5f1550b5977e303387b64babaf158e2fd64ff1b2
4 changes: 2 additions & 2 deletions app/controllers/recipes_controller.rb
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ def index
end

#THIS DISPLAYS THE RESULTS OF WHAT WE FOUND WHEN WE DID THE SEARCH
def search
def search #recipes_search_path
@keywords = params['keywords']
if @keywords.nil?
redirect_to root_path

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no flash notice?

@@ -18,7 +18,7 @@ def search
end
end

def search_by_page
def search_by_page #search_by_page_path
@keywords = params['keywords']
if @keywords == ""
redirect_to root_path
42 changes: 42 additions & 0 deletions test/cassettes/recipes.yml

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions test/controllers/recipes_controller_test.rb
Original file line number Diff line number Diff line change
@@ -12,22 +12,21 @@
end

describe "search" do
it "can get the initial search page (recipes 1-10)" do
keywords = "lemon chicken"
it "can get the initial search results page" do
@keywords = "lemon chicken"
VCR.use_cassette("recipes") do
get recipes_search_path, params: keywords
get recipes_search_path params:{keywords: "lemon chicken"}
must_respond_with :success
end
end

it "returns success when recipes match the search term(s) and page parameters are provided" do
it "redirects to the home page if the user enters "
end

describe "search by page (i.e. pagination)" do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good sets of tests.

it "returns success when passed a keyword and recipe numbers (from, to)" do
VCR.use_cassette("recipes") do
@keywords = "lemon chicken"
get recipes_search_path, params: @keywords
# params[:keywords] = "lemon chicken"
# params[:from] = 30
# params[:to] = 39
get search_by_page_path(keywords: @keywords, from: 30, to: 39)
get recipes_search_path params:{keywords: "lemon chicken", from: 30, to: 39}
must_respond_with :success
end
end
2 changes: 1 addition & 1 deletion test/lib/edamam_api_wrapper_test.rb
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

it "can receive a list of recipes as Recipe objects (for a mulitple word search term)" do
VCR.use_cassette("recipes") do
recipes = EdamamApiWrapper.list_recipes("lemon chicken artichoke", 0, 9)
recipes = EdamamApiWrapper.list_recipes("lemon chicken artichoke", 10, 19)
recipes.must_be_instance_of Array
recipes.length.must_be :>, 0
recipes.each do |recipe|