class method self.parallelize_setup

Ruby on Rails 6.1.7.10

Since v6.0.6

Available in: v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

self.parallelize_setup(&block)

Set up hook for parallel testing. This can be used if you have multiple databases or any behavior that needs to be run after the process is forked but before the tests run.

Note: this feature is not available with the threaded parallelization.

In your test_helper.rb add the following:

class ActiveSupport::TestCase
  parallelize_setup do
    # create databases
  end
end

Parameters

block block
Source
# File activesupport/lib/active_support/test_case.rb, line 109
      def parallelize_setup(&block)
        ActiveSupport::Testing::Parallelization.after_fork_hook do |worker|
          yield worker
        end
      end

Defined in activesupport/lib/active_support/test_case.rb line 109 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::TestCase

Type at least 2 characters to search.

↑↓ navigate · open · esc close