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

Error when testing RoR Application "Could not find table 'statuses'"

I am in Building a Simple RoR application and trying to test the app.

I keep getting the following error anytime I try to run a test:

 1) Error:test_that_/login_route_opens_the_login_page(CustomRoutesTest):
 ActiveRecord::StatementInvalid: Could not find table 'statuses'

Anyone know what I can do to get tests working?

1 Answer

Your test database is not there. Run:

rake db:test prepare

Thanks Brandon for your response: I ran the code you said to and ran the test. I got the following error <class:TestCast>':uninitialized constant Devise::TestHeplers (NameError)

From doing some more digging it seemed I need to add the following to my Gem file which I did but it still didn't work: require 'Devise'

still getting <class:TestCase>': uninitialized constant Devise::TestHeplers (NameError)

Any ideas?

In your Gemfile, try addding

gem 'devise'

instead. "require 'Devise" isn't the correct syntax for a Gemfile. After you've done that, in your console run

bundle install

This will install all of the gems that are listed in your Gemfile, which will now include the Devise gem. :)