From 1db7a5c285eeb61acc998c0c27788a61bd948d5c Mon Sep 17 00:00:00 2001 From: eileencodes Date: Mon, 7 Nov 2016 15:46:56 -0500 Subject: Don't load ActionSystemTest in production By moving to the TestUnit Railtie, and doing the file requirement inside the onload call we can avoid loading ActionSystemTest in production and load it in the test env. This is important for performance reasons - loading up unnecessary files and object is expensive, especially when they should never be used in production. --- railties/lib/rails/all.rb | 1 - railties/lib/rails/test_unit/railtie.rb | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/lib/rails/all.rb b/railties/lib/rails/all.rb index 2cc33ceb5e..7606ea0e46 100644 --- a/railties/lib/rails/all.rb +++ b/railties/lib/rails/all.rb @@ -9,7 +9,6 @@ require "rails" action_cable/engine rails/test_unit/railtie sprockets/railtie - action_system_test/railtie ).each do |railtie| begin require railtie diff --git a/railties/lib/rails/test_unit/railtie.rb b/railties/lib/rails/test_unit/railtie.rb index d3f52e8008..694c8d92b1 100644 --- a/railties/lib/rails/test_unit/railtie.rb +++ b/railties/lib/rails/test_unit/railtie.rb @@ -20,6 +20,18 @@ module Rails } end + config.system_testing = ActiveSupport::OrderedOptions.new + + initializer "system_testing.set_configs" do |app| + ActiveSupport.on_load(:active_support_test_case) do + require "action_system_test" + + options = app.config.system_testing + options.driver ||= ActionSystemTest.default_driver + options.each { |k, v| ActionSystemTest.send("#{k}=", v) } + end + end + rake_tasks do load "rails/test_unit/testing.rake" end -- cgit v1.2.3