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

Displaying the Correct Statuses: errors

Hey guys I am still stuck on the final part of the ruby on rails lesson for "Displaying correct Statuses," when I run the test I get these errors:

     14) Error:test_should_show_status(StatusesControllerTest): ActiveRecord::RecordNotUnique:       SQLite3::ConstraintException: column email is not unique: INSERT INTO "statuses" ("content",     "created_at","updated_at", "id", "user_id") VALUES ('MyText', '2013-07-24 22:24:41', '2013-07-24 22:24:41',     2984863
    74, 149087659)

      15) Error: test_should_update_status_for_the_current_user_when_logged_in(StatusesController
    Test): ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: column email is not unique: INSERT     INTO "statuses" ("content", "created_at", "updated_at", "id", "user_id") VALUES ('MyText', '2013-07-24     22:24:41', '2013-07-24 22:24:41', 298486374, 149087659)

     16) Error: test_should_update_status_when_logged_in(StatusesControllerTest):     ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: column email is not unique: INSERT INTO     "statuses" ("content", "created_at", "updated_at", "id", "user_id") VALUES ('MyText', '2013-07-24 22:24:41',     '2013-07-24 22:24:41', 298486374, 149087659)

I made sure to compare this to the code they have in the project files and can't find the errors. All three have the column email is not unique message. If you think of anything guys let me know. Thanks.

4 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Do you have more than one user with the same email address in your fixtures?

Do you mean the users.yml? No, they all have different emails.

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Can you paste your users.yml file as well as the failing test?

Sorry for the delay, test\functional\statuses_controller_test.rb

Here is the yml file

jason:
  first_name: "Jason"
  last_name: "Seifer"
  email: "jason@teamtreehouse.com"
  profile_name: "jasonseifer"
  encrypted_password: "$2a$10$Fh/Hm8RxDsuPTeBUr6864.GARlcmt7zF2WspaXGr3BIv2C27N.osq"

jim:
  first_name: "Jim"
  last_name: "Hoskins"
  email: "jim@teamtreehouse.com"
  profile_name: "jimhoskins"

mike:
  first_name: "Mike"
  last_name: "The Frog"
  email: "mike@teamtreehouse.com"
  profile_name: "mikethefrog"

blocked_friend:
  first_name: 'Blocked'
  last_name: 'Friend'
  email: 'blocked@teamtreehouse.com'
  profile_name: 'youblockedme'

I changed all the names in the tests to be like in the videos to cut down on confusion.

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Allan Evans I'm afraid I can't quite tell from this example. Could you possibly zip up your code and email it to help@teamtreehouse.com?

Ok, its sent.

Did you get the zip file Jason?