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

Lisa Rossiter
Lisa Rossiter
3,630 Points

Problem with testing database

I have been out of the game with my app for a while and after being spurred on by the active record series with hampton I have failed at the first hurdle. I added a few migrations with tables and my db was shouting at me to migrate the test database so I did and ran into errors even though I am doing the right thing, I rolled back tried again and ended up reseting the database which was painful. I then migrated both the live and test database again.

Now it is complaining that there is methods missing such as full name and other data although it is fully working in my app. If anyone could help that would be great because I am stuck. I spend half my time fixing my tests when my app works as expected :)

Maybe a full series on testing and the problems, when to do it and not would be a good idea because you guys have covered so many now its a little confusing for a novice.

2 Answers

If you're only running into these problems while testing you may need to migrate the test database specifically (though it sounds like you may have already done this).

In rails 3: rake db:test:prepare

Rails 4 removes db:test:prepare and instead makes it a prerequisite to rake test or rake spec depending on what you're using to test your app. Let me know if you have any more info or were able to solve this.

Lisa Rossiter
Lisa Rossiter
3,630 Points

Thanks G

It was me being an idiot in the end I added a few bits that required current_user from devise and I had not updated devise to login a user. I appreciate your detailed help thank you.