Jeremy Jeremy - 12 days ago 5
Ruby Question

Create a devise fixtures user devise a password

I have a rails 5 app running the latest devise and I'd like to create valid users for testing with the fixtures, but I can't update the password as the way devise has users set up there is no passwords column in the users table.

Is there a way to set the fixture up to work around this and have a working user?

text/fixtures/users.yml:

jeremy:
email: jeremy@someemail.com
provider: facebook
username: Jeremy


password: password

any test using that user returns:

ActiveRecord::Fixture::FixtureError: ActiveRecord::Fixture::FixtureError: table "users" has no column named "password".

Answer

Prepare your test database.

rake db:migrate
rake db:test:prepare