class ActiveSupport::TestCase

def parallelize(workers: :number_of_processors, with: :processes)

The processes parallelization uses a Ruby DRb server.
The threaded parallelization uses minitest's parallel executor directly.

parallelize(workers: :number_of_processors, with: :threads)

database and will not work with system tests at this time.
method. Note the threaded parallelization does not create multiple
use threads instead you can pass with: :threads to the +parallelize+
The default parallelization method is to fork processes. If you'd like to

set to the actual core count on the machine you are on.
If +workers+ is set to +:number_of_processors+, the number of workers will be

parallelized.
If the number of workers is set to +1+ or fewer, the tests will not be

you do for local testing.
environments, or other environments where you may need more workers than
and the environment variable will be used instead. This is useful for CI
If ENV["PARALLEL_WORKERS"] is set the workers argument will be ignored

test-database-1
test-database-0

with the worker number.
is forked. For each process a new database will be created suffixed
Takes a +workers+ argument that controls how many times the process

Parallelizes the test suite.
def parallelize(workers: :number_of_processors, with: :processes)
  workers = Concurrent.physical_processor_count if workers == :number_of_processors
  workers = ENV["PARALLEL_WORKERS"].to_i if ENV["PARALLEL_WORKERS"]
  return if workers <= 1
  executor = case with
             when :processes
               Testing::Parallelization.new(workers)
             when :threads
               Minitest::Parallel::Executor.new(workers)
             else
               raise ArgumentError, "#{with} is not a supported parallelization executor."
  end
  self.lock_threads = false if defined?(self.lock_threads) && with == :threads
  Minitest.parallel_executor = executor
  parallelize_me!
end