forked from fixin.me/fixin.me
26 lines
675 B
Ruby
26 lines
675 B
Ruby
ENV["RAILS_ENV"] ||= "test"
|
|
require_relative "../config/environment"
|
|
require "rails/test_help"
|
|
|
|
class ActiveSupport::TestCase
|
|
# Run tests in parallel with specified workers
|
|
parallelize(workers: :number_of_processors)
|
|
|
|
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
|
fixtures :all
|
|
|
|
include AbstractController::Translation
|
|
|
|
def randomize_user_password!(user)
|
|
random_password.tap { |p| user.update!(password: p) }
|
|
end
|
|
|
|
def random_password
|
|
SecureRandom.alphanumeric rand(Rails.configuration.devise.password_length)
|
|
end
|
|
|
|
def random_email
|
|
"%s@%s.%s" % (1..3).map { SecureRandom.alphanumeric(rand(1..20)) }
|
|
end
|
|
end
|