Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

Validating Presence Error

Hey Treehouse. Can anyone help with this? it's the error message I get after running the test command in the validating presence video. I've done rake db:migrate and rake db:test:prepare

test_a_user_should_enter_a_first_name(UserTest): ActiveRecord::StatementInvalid: SQLite3::ConstraintException: constraint failed: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2013-04-15 17:51:05', '2013-04-15 17:51:05', 298486374)


3 Answers

Do you have those fields in your test fixture? If so remove them, also ensure you have the fixtures properly nested and spaced using 2 spaces.

test > fixtures > users.yml

  first_name: "Jason"
  last_name: "Seifer"
  email: "jason@teamtreehouse.com"
  profile_name: "jasonseifer"

Thanks Drake. All sorted

Mine is empty and am still getting same error message.