简体   繁体   中英

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".

Prepare your test database.

rake db:migrate
rake db:test:prepare

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM