I\'m following along with the rails tutorial. I\'m on ch. 6 and I\'m getting a strange error with SQLite3 (for the record, I\'m using sqlite version 1.3.10 and the tutorial uses
I experienced it for a bit different reason and here is the solution.
For me the error was
Minitest::UnexpectedError: ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: UNIQUE constraint failed: users.email: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2018-05-09 18:23:59.827561', '2018-05-09 18:23:59.827561', 298486374)
Notice the INTO "users" ("created_at", "updated_at", "id")
. It was caused by test/fixtures/users.yml was not filled, so then there was duplicate values in columns which has unique key constraint.
test/fixtures/users.yml:
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value