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 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