diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2016-10-21 11:27:26 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2016-10-21 13:10:26 -0700 |
commit | 797f1dd63c68eb44c1af358d377cfef271e685c5 (patch) | |
tree | 32aa16b9fc05ee202afca56f002c884b770737fd /railties/test/application | |
parent | 54a5b99a007dd773aa25183fa29e7c87a86a29da (diff) | |
download | rails-797f1dd63c68eb44c1af358d377cfef271e685c5.tar.gz rails-797f1dd63c68eb44c1af358d377cfef271e685c5.tar.bz2 rails-797f1dd63c68eb44c1af358d377cfef271e685c5.zip |
Prevent the test framework from being loaded in production mode
The test framework should not be autoloaded in production mode. Before
this commit, the testing railtie would extend AS::TestCase. This caused
AS::TestCase to be preloaded regardless of the environment in which we
were running.
This commit just moves the code that adds line filtering support in to
the test command where we actually execute the test runner. That allows
us to maintain the line runner feature but only load the minimal amount
of code we need.
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/runner_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/test/application/runner_test.rb b/railties/test/application/runner_test.rb index 77e7a2cca5..8769703f66 100644 --- a/railties/test/application/runner_test.rb +++ b/railties/test/application/runner_test.rb @@ -43,6 +43,15 @@ module ApplicationTests assert_match "42", Dir.chdir(app_path) { `bin/rails runner "bin/count_users.rb"` } end + def test_no_minitest_loaded_in_production_mode + app_file "bin/print_features.rb", <<-SCRIPT + p $LOADED_FEATURES.grep(/minitest/) + SCRIPT + assert_match "[]", Dir.chdir(app_path) { + `RAILS_ENV=production bin/rails runner "bin/print_features.rb"` + } + end + def test_should_set_dollar_0_to_file app_file "bin/dollar0.rb", <<-SCRIPT puts $0 |