Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrian Patterson
19,588 PointsI don't know why I am getting a failure?
Have inputted the code and I am getting this error.
Failures:
1) Viewing todo items displays the title of the todo list
Failure/Error: visit "/todo_list"
ActionController::RoutingError:
No route matches [GET] "/todo_list"
# ./spec/features/todo_items/index_spec.rb:7:in `visit_todo_list'
# ./spec/features/todo_items/index_spec.rb:18:in `block (2 levels) in <top (required)>'
2) Viewing todo items displays no items when a todo list is empty
Failure/Error: visit "/todo_list"
ActionController::RoutingError:
No route matches [GET] "/todo_list"
# ./spec/features/todo_items/index_spec.rb:7:in `visit_todo_list'
# ./spec/features/todo_items/index_spec.rb:25:in `block (2 levels) in <top (required)>'
Here is my code
require 'spec_helper'
describe "Viewing todo items" do
let!(:todo_list) { TodoList.create(title: "Grocery list", description: "Groceries") }
def visit_todo_list(list)
visit "/todo_lists"
within "#todo_list_#{list.id}" do
click_link "List Items"
end
end
it "displays the title of the todo list" do
visit_todo_list(todo_list)
within("h1") do
expect(page).to have_content(todo_list.title)
end
end
it "displays no items when a todo list is empty" do
visit_todo_list(todo_list)
expect(page.all("ul.todo_items li").size).to eq(0)
end
it "displays item content when a todo list has items" do
todo_list.todo_items.create(content: "Milk")
todo_list.todo_items.create(content: "Eggs")
visit_todo_list(todo_list)
expect(page.all("ul.todo_items li").size).to eq(2)
within "ul.todo_items" do
expect(page).to have_content("Milk")
expect(page).to have_content("Eggs")
end
end
end
1 Answer
Andrew Stelmach
12,583 PointsRun rake routes
in the terminal - do you have a route called '/todo_list'?
Post up your routes.rb
file, too. And link to your Github repo, if you have one.
Brian Patterson
19,588 PointsBrian Patterson
19,588 PointsHere is my bin/rake routes
And here is my routes.rb file.
Don't know how to link to my Github Repo. I have looked in my Github and I don't see the project.
Brian Patterson
19,588 PointsBrian Patterson
19,588 PointsHere is the link to the Github Repo https://github.com/amidabrian51/odot.git