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 trial

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

Nelly Lam
Nelly Lam
5,098 Points

Todo List App - Error

At around minute 4:20, I run the rake tests, and I got an additional error:

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: Expected exactly 2 elements matching "tr > td", found 1.. Expected: 2 Actual: 1 # ./spec/views/todo_lists/index.html.erb_spec.rb:20:in `block (2 levels) in <top (required)>'

the file it's referencing:

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

We haven't touched this file, so I'm not sure if this is the origin of the problem... Any tips?

Nelly Lam
Nelly Lam
5,098 Points

Ah... just realized what happened.

I scrolled up to read the error messages and saw this: ................................***.....ignoring attempt to close td with tr

It's referencing the spec for index.html.erb, so I went back to the file index.html.erb and checked all the tr and td tags. Turns out one of them is not closed. It must've happened when we re-organized the links and deleted a bunch of tags.

Whew! No need to worry everyone. It's fixed!

great job this helped me thank you!

1 Answer