Semyon Perepelitsa kindly posted the following snippet for test_helper / spec_helper:
require "bcrypt" silence_warnings do BCrypt::Engine::DEFAULT_COST = BCrypt::Engine::MIN_COST end
This weakens the hash function, making the hash calculation almost instantaneous in test mode - exactly what we want!
source share