Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Adding Validations to Todo Items

Ed Fernandez
Ed Fernandez
13,245 Points

untouched spec file fails

In this lesson video, when running "rake" to validate all spec files, I get an error on a spec file that I did not modify.

The error message is:


Failures:

1) todo_lists/index renders a list of todo_lists Failure/Error: assert_select "tr>td", :text => "Title".to_s, :count => 2 MiniTest::Assertion: <Title> expected but was <Title MyText>.. <0> expected but was <2>. # ./spec/views/todo_lists/index.html.erb_spec.rb:20:in `block (2 levels) in <top (required)>'


The contents of the unmodified index.html.erb_spec.rb file are:


require 'spec_helper'

describe "todo_lists/index" do before(:each) do assign(:todo_lists, [ stub_model(TodoList, :title => "Title", :description => "MyText" ), stub_model(TodoList, :title => "Title", :description => "MyText" ) ]) end

it "renders a list of todo_lists" do render # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "tr>td", :text => "Title".to_s, :count => 2 assert_select "tr>td", :text => "MyText".to_s, :count => 2 end end


Has anyone else experienced this error? Any solutions?

Thanks.

1 Answer

Ed Fernandez
Ed Fernandez
13,245 Points

Ok, mystery solved.

The error had to do with forgetting to add a closing "</td>" after the "Title" field in my "/todo_lists/index.html.erb" file.