aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2015-01-23 20:58:48 -0500
committerYves Senn <yves.senn@gmail.com>2015-03-18 09:52:17 +0100
commit739cfd5d90aff0d8eba3d3937df63afaa6ad106f (patch)
tree7a2332b39c158289062f15cbf388906cceb0dc36 /railties
parent5ae2c7060f6a1bf23fd598eb92ff5417ac589dcc (diff)
downloadrails-739cfd5d90aff0d8eba3d3937df63afaa6ad106f.tar.gz
rails-739cfd5d90aff0d8eba3d3937df63afaa6ad106f.tar.bz2
rails-739cfd5d90aff0d8eba3d3937df63afaa6ad106f.zip
Move some logic to runner
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/commands/test.rb14
-rw-r--r--railties/lib/rails/test_unit/runner.rb10
2 files changed, 11 insertions, 13 deletions
diff --git a/railties/lib/rails/commands/test.rb b/railties/lib/rails/commands/test.rb
index cd1192eb6e..1efd010dc7 100644
--- a/railties/lib/rails/commands/test.rb
+++ b/railties/lib/rails/commands/test.rb
@@ -1,19 +1,7 @@
ENV["RAILS_ENV"] = "test"
require "rails/test_unit/runner"
-require "rails/test_unit/reporter"
options = Rails::TestRunner::Options.parse(ARGV)
$: << File.expand_path("../../test", APP_PATH)
-$runner = Rails::TestRunner.new(options)
-
-def Minitest.plugin_rails_init(options)
- self.reporter << Rails::TestUnitReporter.new(options[:io], options)
- if method = $runner.find_method
- options[:filter] = method
- end
-end
-Minitest.extensions << 'rails'
-
-# Config Rails backtrace in tests.
-$runner.run
+Rails::TestRunner.new(options).run
diff --git a/railties/lib/rails/test_unit/runner.rb b/railties/lib/rails/test_unit/runner.rb
index c76bd58d22..31ce94a503 100644
--- a/railties/lib/rails/test_unit/runner.rb
+++ b/railties/lib/rails/test_unit/runner.rb
@@ -2,6 +2,7 @@ require "ostruct"
require "optparse"
require "rake/file_list"
require "method_source"
+require "rails/test_unit/reporter"
module Rails
class TestRunner
@@ -59,6 +60,15 @@ module Rails
def run
enable_backtrace if @options[:backtrace]
+ $rails_test_runner = self
+ def Minitest.plugin_rails_init(options)
+ self.reporter << Rails::TestUnitReporter.new(options[:io], options)
+ if method = $rails_test_runner.find_method
+ options[:filter] = method
+ end
+ end
+ Minitest.extensions << 'rails'
+
run_tests
end