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 trialJONATHAN PACHA
12,039 PointsI am getting failed examples when running my rspec for the new todo_items.rb
This is my failure list:
Failed examples:
rspec ./spec/features/todo_items/index_spec.rb:5 # Viewing todo items displays no items when the todo list is empty
Randomized with seed 39175
treehouse:~/projects/odot (master *) $ bin/rspec spec/features/todo_items/index_spec.rb F
Failures:
1) Viewing todo items displays no items when the todo list is empty Failure/Error: expect(page).to have_content("#TodoItems#index") expected to find text "#TodoItems#index" in "TodoItems#index Find me in app/views/todo_items/index.html.erb" # ./spec/features/todo_items/index_spec.rb:10:in `block (2 levels) in <top (required)>'
here is my code for index.html.erb:
<h1>Listing todo_lists</h1>
<table> <thead> <tr> <th>Title</th> <th>Description</th> <th></th> <th></th> <th></th> </tr> </thead>
<tbody> <% @todo_lists.each do |todo_list| %> <tr id="<%= dom_id(todo_list) %>"> <td><%= todo_list.title %></td> <td><%= todo_list.description %></td> <td> <%= link_to "List Items", todo_list_todo_items_path(todo_list) %> <%= link_to 'Show', todo_list %> <%= link_to 'Edit', edit_todo_list_path(todo_list) %> <%= link_to 'Destroy', todo_list, method: :delete, data: { confirm: 'Are you sure?' } %> </td> </tr> <% end %> </tbody> </table>
<br>
<%= link_to 'New Todo list', new_todo_list_path %>
here is the code for index_spec.rb:
require 'spec_helper'
describe "Viewing todo items" do let!(:todo_list) { TodoList.create(title: "Grocery list", description: "Groceries") } it "displays no items when the todo list is empty" do visit "/todo_lists" within "#todo_list_#{todo_list.id}" do click_link "List Items" end expect(page).to have_content("#TodoItems#index") end end
1 Answer
Maciej Czuchnowski
36,441 Pointsexpected to find text "#TodoItems#index" in "TodoItems#index
Change your expectation OR change the view's content.
JONATHAN PACHA
12,039 PointsJONATHAN PACHA
12,039 PointsThank you very much. I'm an idiot. I cannot believe I spent that much time on that.