forked from fixin.me/fixin.me
Add Unit system tests
This commit is contained in:
@@ -12,6 +12,14 @@ class ActiveSupport::TestCase
|
||||
include AbstractController::Translation
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
# NOTE: use public #alphanumeric(chars: ...) from Ruby 3.3 onwards
|
||||
SecureRandom.class_eval do
|
||||
def self.random_symbol(n = 10)
|
||||
# Unicode characters: 32-126, 160-383
|
||||
choose([*' '..'~', 160.chr, *'¡'..'ſ'], n)
|
||||
end
|
||||
end
|
||||
|
||||
def randomize_user_password!(user)
|
||||
random_password.tap { |p| user.update!(password: p) }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user