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 Write Our First Tests

Failure on comparing TodoList.count

Test fails on second part

 1) creating to do lists displays an error when there is no title
 Failure/Error: expect(TodoList.count).to eq(0)
   expected: 0
        got: 10

   (compared using ==)
 # ./spec/features/todo_lists/create_spec.rb:8:in `block (2 levels) in <top (required)>'

Is the test not clearing the database on each execution?

The test is executed in Terminal by: rspec spec/features/todo_lists/create_spec.rb

1 Answer

Rachelle Wood
Rachelle Wood
15,362 Points

Hi, this is an old question. I don't know if you managed to fix it, but I had a very similar error. Just change 10 out for a 1. In my case, it turned out to be a problem with the validation step. For some reason, I had no concerns folder in my app/models folder. There was a todo_list.rb file though in the models folder. When I put the validation code in it, it worked! Maybe that will work for you if you are using rspec 2.99?