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
  Paul Dietrich
4,557 PointsRuby - Writing Tests
Hello,
After following along in the "Fixtures" video, Jason runs "ruby -Itest test/unit/user_test.rb" and does not come up with any errors. I, on the other hand, am coming up with the following error (I have followed along through the video, and have checked to see if there were any syntax errors. There were not):
4 tests, 0 assertions, 0 failures, 4 errors, 0 skips
1) Error: test_a_user_should_enter_a_first_name(UserTest): ActiveRecord::StatementInvalid: SQLite3::SQLException: table users has no column named password: INSERT INTO "users" ("first_name", "last_name", "email", "profile_name", "password", "password_confirmation", "created_at", "updated_at", "id") VALUES ('Paul', 'Dietrich', 'pdietrich@musd.org', 'pauldietrich', 'password', 'password', '2013-04-26 02:27:33', '2013-04-26 02:27:33', 354582103)
2) Error: test_a_user_should_enter_a_last_name(UserTest): ActiveRecord::StatementInvalid: SQLite3::SQLException: table users has no column named password: INSERT INTO "users" ("first_name", "last_name", "email", "profile_name", "password", "password_confirmation", "created_at", "updated_at", "id") VALUES ('Paul', 'Dietrich', 'pdietrich@musd.org', 'pauldietrich', 'password', 'password', '2013-04-26 02:27:33', '2013-04-26 02:27:33', 354582103)
3) Same error as above
4) Same error as above
I'm missing something...
7 Answers
Uriel Hernández
3,681 PointsCould you execute "rails console" And in the console type: u = User.first
And show us what you get, seems like your User Model is missing something.
Ryan Carson
23,287 PointsPaul Dietrich great to see you've been made a Moderator! Thanks for all your hard work :)
Philipp Antar
7,216 PointsRails complains that the database has no column named 'password'. This usually means your database is not up to date and can often be rectified by running the migrations by running rake db:migrate in your terminal. 
Since you're using the devise gem, there are some specialities you need to pay attention to, which are covered in this video.
Another possible point of failure could be the test-database, which is seperate from your development and production databases. Try running rake db:test:prepare in your terminal to rebuild the test database from the schema.
Sources: Rails Migrations
HTH
Paul Dietrich
4,557 PointsThanks, Ryan! I was very surprised when I saw the update.
Uriel, this is what I get after typing those commands in the console:
Loading development environment (Rails 3.2.8) 1.9.3p194 :001 > u = User.first User Load (0.2ms) SELECT "users".* FROM "users" LIMIT 1 => #<User id: 2, first_name: "Paul", last_name: "Dietrich", profile_name: "pdietrich", email: "pdietrich@musd.org", encrypted_password: "$2a$10$s0RdxTuXB3c3si741P1.pemF2AE4BYLEjBD6e.BYJC2i...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2013-01-17 06:17:30", last_sign_in_at: "2013-01-17 06:17:30", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2013-01-17 06:17:30", updated_at: "2013-01-17 06:17:30">
Paul Dietrich
4,557 PointsIt didn't paste all the way:
Loading development environment (Rails 3.2.8)
1.9.3p194 :001 > u = User.first
  User Load (0.2ms)  SELECT "users".* FROM "users" LIMIT 1
 => #< User id: 2, first_name: "Paul", last_name: "Dietrich", profile_name: "pdietrich", email: "pdietrich@musd.org", encrypted_password: "$2a$10$s0RdxTuXB3c3si741P1.pemF2AE4BYLEjBD6e.BYJC2i...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2013-01-17 06:17:30", last_sign_in_at: "2013-01-17 06:17:30", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2013-01-17 06:17:30", updated_at: "2013-01-17 06:17:30" >
I placed a space between the first "<" after "LIMIT 1 => #" and the very last ">".
Paul Dietrich
4,557 PointsBumping this up!
Philipp Antar
7,216 PointsPaul Dietrich did you try to run the migrations? Or rebuilding the test database?