Hi, I have a test similar to this
test 'create account' do if User.create(email: ' me@test.com ', password: 'blahblah') assert true else assert User.msg end end
But when I try to start it, I get an error message:
1) Error: UserTest#test_create_account: ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_email" DETAIL: Key (email)=() already exists. : INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2013-10-16 21:59:54', '2013-10-16 21:59:54', 298486374)
It looks like I did not initialize the email, but as I understand it, it should be initialized with my created above. I use strong options, so I don't have attr_accessable, and I can run this. Does anyone know what could be causing this? If you need more information, let me know.
source share