diff options
author | Dominic Cleal <dominic@cleal.org> | 2017-01-25 15:58:11 +0000 |
---|---|---|
committer | Dominic Cleal <dominic@cleal.org> | 2017-02-04 13:54:52 +0100 |
commit | 1c8a4cdf63134f34d638703a956c2706d8e3789f (patch) | |
tree | 9b97fd307605aeeea935851e43731cc55225c04c /railties/lib/rails/test_unit | |
parent | d833e9346839a3e8fca6098e3a5e456354873f8f (diff) | |
download | rails-1c8a4cdf63134f34d638703a956c2706d8e3789f.tar.gz rails-1c8a4cdf63134f34d638703a956c2706d8e3789f.tar.bz2 rails-1c8a4cdf63134f34d638703a956c2706d8e3789f.zip |
Collect all file patterns when running multiple rake test tasks
Replaces the rake_patterns instance variable with simple require, as
`autorun` will run tests from all eagerly required test files.
Fixes #27801
Diffstat (limited to 'railties/lib/rails/test_unit')
-rw-r--r-- | railties/lib/rails/test_unit/minitest_plugin.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/railties/lib/rails/test_unit/minitest_plugin.rb b/railties/lib/rails/test_unit/minitest_plugin.rb index e3c70b0b3d..4df3e7f0f2 100644 --- a/railties/lib/rails/test_unit/minitest_plugin.rb +++ b/railties/lib/rails/test_unit/minitest_plugin.rb @@ -59,19 +59,18 @@ module Minitest options[:color] = true options[:output_inline] = true - options[:patterns] = defined?(@rake_patterns) ? @rake_patterns : opts.order! + options[:patterns] = opts.order! unless run_via[:rake] end - # Running several Rake tasks in a single command would trip up the runner, - # as the patterns would also contain the other Rake tasks. def self.rake_run(patterns) # :nodoc: - @rake_patterns = patterns + run_via[:rake] = true + ::Rails::TestRequirer.require_files(patterns) autorun end module RunRespectingRakeTestopts def run(args = []) - if defined?(@rake_patterns) + if run_via[:rake] args = Shellwords.split(ENV["TESTOPTS"] || "") end @@ -86,8 +85,9 @@ module Minitest def self.plugin_rails_init(options) ENV["RAILS_ENV"] = options[:environment] || "test" - # If run via `ruby` we've been passed the files to run directly. - unless run_via[:ruby] + # If run via `ruby` we've been passed the files to run directly, or if run + # via `rake` then they have already been eagerly required. + unless run_via[:ruby] || run_via[:rake] ::Rails::TestRequirer.require_files(options[:patterns]) end |