-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Speed up your unit tests
Leandro Alves edited this page Mar 13, 2018
·
6 revisions
Note: this setting is now provided by default!
In your configuration (devise.rb initializer), set the number of stretches to 1 for your test environment:
config.stretches = Rails.env.test? ? 1 : 10
This will increase performance dramatically if you use bcrypt and create a lot of users (e.g. if you use Factory Bot or Machinist).
Key stretching is a method of improving the security of passwords at the expense of speed. In the test environment, we are more concerned about speed than people trying to hack the passwords in the test database, so we turn the number of stretches down to 1.