Dev
Dev

Reputation: 467

SQLite3::ConstraintException: UNIQUE constraint failed: users.email: INSERT INTO "users"

I just installed the devise gem and I'm getting the following error:

Error:
AccountsControllerTest#test_should_update_account:
ActiveRecord::RecordNotUnique: SQLite3::ConstraintException: UNIQUE  constraint failed: users.email: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2017-09-19 08:32:47.975048', '2017-09-19 08:32:47.975048', 298486374)

This is the procedure I followed:

gem 'devise'
bundle install
rails generate devise:install
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
rails generate devise user
devise_for :users, path: 'users'
config.scoped_views = true
rails g devise:views users
rails generate devise:controllers users

Any idea what might be wrong?

Upvotes: 2

Views: 2112

Answers (1)

Dev
Dev

Reputation: 467

I found the solution! I had to change the test/fixtures/users.yml file to this:

one:
  email: [email protected]

two:
  email: [email protected]

Upvotes: 5

Related Questions