Skip to content

Commit 67c83d0

Browse files
kcdragonclaude
andauthored
Lower bcrypt cost in tests to speed up the suite (#27)
Set BCrypt::Engine.cost to the minimum in test_helper so fixtures and has_secure_password digests stop hashing at the default cost (12). This roughly halves the suite's CPU time and speeds up password-touching specs. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7ed77aa commit 67c83d0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎test/test_helper.rb‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
ENV["RAILS_ENV"] ||= "test"
2+
3+
# Hash passwords at bcrypt's minimum cost in tests to improve test speed.
4+
require "bcrypt"
5+
BCrypt::Engine.cost = BCrypt::Engine::MIN_COST
6+
27
require_relative "../config/environment"
38
require "rails/test_help"
49
require_relative "test_helpers/session_test_helper"

0 commit comments

Comments
 (0)