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 Editing Todo Lists

Tests from create do not create todo_list items

HI.

I have gotten to the editing todo_lists video and I thought everything was great, so far every test had failed as it should, passed when it should - so far so good. But one of the first things said in the editing video is visiting the todo_lists index page should have todo_lists already added, and in the video it shows the grocery list todo list created presumably by the test(s) in create_spec.rb but my todo_lists index page is empty. It seems that empty is right though, as some of the tests in create spec are expecting the count of todo_lists to be zero so... I am just checking what is the score here. Thanks.

1 Answer

Martin Cornejo Saavedra
Martin Cornejo Saavedra
18,132 Points

Test do use another database for testing, that's why the list you see in your app doesn't represent the one in the tests. Remember when migrating the databases, you used the command twice, on for the database and another for the testing database.

rake db:migrate   #migrates pending databases
rake db:migrate RAILS_ENV=test   #separate database for testing

I went into the server using -e test but I still don't see the lists that should be created by the create_spec.rb tests