Include parallelize :threads option when fork is not available

This commit is contained in:
Brandon Fish 2020-02-17 10:43:35 -06:00
parent 8d02c0d300
commit b4ccdcb73a
3 changed files with 5 additions and 5 deletions

@ -535,7 +535,7 @@ class ActiveSupport::TestCase
end
```
Rails applications generated from JRuby will automatically include the `with: :threads` option.
Rails applications generated from JRuby or TruffleRuby will automatically include the `with: :threads` option.
The number of workers passed to `parallelize` determines the number of threads the tests will use. You may
want to parallelize your local test suite differently from your CI, so an environment variable is provided

@ -4,10 +4,10 @@ require "rails/test_help"
class ActiveSupport::TestCase
# Run tests in parallel with specified workers
<% if defined?(JRUBY_VERSION) || Gem.win_platform? -%>
parallelize(workers: :number_of_processors, with: :threads)
<%- else -%>
<% if Process.respond_to?(:fork) && !Gem.win_platform? -%>
parallelize(workers: :number_of_processors)
<%- else -%>
parallelize(workers: :number_of_processors, with: :threads)
<% end -%>
<% unless options[:skip_active_record] -%>

@ -862,7 +862,7 @@ def test_spring_binstubs
def test_spring_no_fork
jruby_skip "spring doesn't run on JRuby"
assert_called_with(Process, :respond_to?, [[:fork], [:fork], [:fork]], returns: false) do
assert_called_with(Process, :respond_to?, [[:fork], [:fork], [:fork], [:fork]], returns: false) do
run_generator
assert_no_gem "spring"