aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2018-02-16 08:09:02 -0500
committerGitHub <noreply@github.com>2018-02-16 08:09:02 -0500
commit7286d81312be3be925e6ba35823daa9910c6ab46 (patch)
tree4c489fef54f52b79daf28dbe94ee8b8215665c77 /railties/lib/rails
parent23c5558f37c2c55807e7603415214f2b4b7b22c1 (diff)
parent26821d9b572815a39c8ecb2e19375b2abff68730 (diff)
downloadrails-7286d81312be3be925e6ba35823daa9910c6ab46.tar.gz
rails-7286d81312be3be925e6ba35823daa9910c6ab46.tar.bz2
rails-7286d81312be3be925e6ba35823daa9910c6ab46.zip
Merge pull request #31900 from eileencodes/parallel-testing
Parallel testing
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt7
-rw-r--r--railties/lib/rails/test_help.rb1
2 files changed, 8 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt
index 52d68cc77c..c918b57eca 100644
--- a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt
+++ b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt
@@ -3,6 +3,13 @@ require_relative '../config/environment'
require 'rails/test_help'
class ActiveSupport::TestCase
+ # Run tests in parallel with specified workers
+<% if defined?(JRUBY_VERSION) -%>
+ parallelize(workers: 2, with: :threads)
+<%- else -%>
+ parallelize(workers: 2)
+<% end -%>
+
<% unless options[:skip_active_record] -%>
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb
index 76c28ac85e..4bd7d74b04 100644
--- a/railties/lib/rails/test_help.rb
+++ b/railties/lib/rails/test_help.rb
@@ -22,6 +22,7 @@ if defined?(ActiveRecord::Base)
module ActiveSupport
class TestCase
+ include ActiveRecord::TestDatabases
include ActiveRecord::TestFixtures
self.fixture_path = "#{Rails.root}/test/fixtures/"
self.file_fixture_path = fixture_path + "files"