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
Trevor Williams
5,859 PointsRuby on Rails: Validating tests
Hello,
I've been following along step by step in the 'Validating' Presence video, and I'm getting an error when I try to run my test....
ActiveRecord::StatementInvalid: Could not find table 'statuses'
Did I forget to name a table somewhere earlier in the series? :/
15 Answers
Jason Seifer
Treehouse Guest TeacherTry running "rake db:migrate" and "rake db:test:prepare" and see if that fixes it.
Trevor Williams
5,859 PointsHi Jason,
After I run rake db:test:prepare, I'm told to run rake db:migrate again. I'm stuck in a loop lol. I noticed 'AddDeviseToUsers', does my problem have something to do with devise?
www:treebook trevorwilliams$ rake db:test:prepare
You have 1 pending migrations:
20130216215424 AddDeviseToUsers
Run rake db:migrate to update your database then try again.
Philip Lilliefelth
2,970 PointsHi I have the same problem with the Statuses table missing error, but nothing seems to fix it? Any ideas why, i am pretty new to this
Giles Thomas
1,114 PointsThanks Jason that worked for me!
Trevor Williams
5,859 PointsI've been stuck on this for almost 2 weeks... lmao
Jennifer Fry
9,855 Pointssame here!
Giles Thomas
1,114 Pointstry dropping your db, then bundle install, rake db:migrate..I had to reinstall rvm also
Philip Lilliefelth
2,970 PointsFixed it, but i get these errors now.
1) Error:
test_a_user_should_enter_a_first_name(UserTest):
NoMethodError: undefined method save' for "User":String
test/unit/user_test.rb:6:inblock in <class:UserTest>'
2) Error:
test_a_user_should_enter_a_last_name(UserTest):
NoMethodError: undefined method save' for "User":String
test/unit/user_test.rb:13:inblock in <class:UserTest>'
3) Error:
test_a_user_should_enter_a_profile_name(UserTest):
NoMethodError: undefined method save' for "User":String
test/unit/user_test.rb:20:inblock in <class:UserTest>'
4) Error:
test_a_user_should_have_a_unique_profile_name(UserTest):
NoMethodError: undefined method profile_name=' for "User":String
test/unit/user_test.rb:27:inblock in <class:UserTest>'
then i tried to "rake db:reset" again and now the test doesnt run and i get
test/unit/user_test.rb:43: syntax error, unexpected keyword_end, expecting $end
baffled! lol
Giles Thomas
1,114 PointsI would check your user test code against the tut vid...other than that I couldnt say
Philip Lilliefelth
2,970 Pointsoops rookie error, i had an extra "end" on the user_test.rb file that i removed... now works well... I love treehouse
Giles Thomas
1,114 PointsGreat! Glad to be of help!
Trevor Williams
5,859 PointsThanks for the help, but that didn't end up working
Jason Seifer
Treehouse Guest TeacherHey Trevor feel free to zip up your code and email it to help@teamtreehouse.com if you're still having trouble.
Jason Sherman
825 Pointshey Jason, I have been stuck on this all day and emailed you my code. I'd love to continue this course!
Mark White
4,231 PointsJason's fix worked for me, but I don't quite understand why it happened in the first place. It happened after I started trying to "test the full app" project. Thanks.
Morhys Malak
Courses Plus Student 6,078 PointsJason you the man!! worked for me.
Spenser Hale
20,915 PointsSpenser Hale
20,915 PointsThank you, solved my problem, got to run prepare then migrate, for my case.