From 0d72489b2a08487f71dd4230846c01a5d99ef35f Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Sun, 25 Jun 2017 19:08:26 +0200 Subject: * Don't eagerly require Rails' minitest plugin. By making the Rails minitest behave like a standard minitest plugin we're much more likely to not break when people use other minitest plugins. Like minitest-focus and pride. To do this, we need to behave like minitest: require files up front and then perform the plugin behavior via the at_exit hook. This also saves us a fair bit of wrangling with test file loading. Finally, since the environment and warnings options have to be applied as early as possible, and since minitest loads plugins at_exit, they have to be moved to the test command. * Don't expect the root method. It's likely this worked because we eagerly loaded the Rails minitest plugin and that somehow defined a root method on `Rails`. * Assign a backtrace to failed exceptions. Otherwise Minitest pukes when attempting to filter the backtrace (which Rails' backtrace cleaner then removes). Means the exception message test has to be revised too. This is likely caused by the rails minitest plugin now being loaded for these tests and assigning a default backtrace cleaner. --- tools/test.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/test.rb b/tools/test.rb index 52e9c19198..774e4ec6c7 100644 --- a/tools/test.rb +++ b/tools/test.rb @@ -3,8 +3,10 @@ $: << File.expand_path("test", COMPONENT_ROOT) require "bundler" Bundler.setup -require "rails/test_unit/minitest_plugin" +require "rails/test_unit/runner" +require "rails/test_unit/reporter" require "rails/test_unit/line_filtering" +require "active_support" require "active_support/test_case" class << Rails @@ -17,5 +19,6 @@ end ActiveSupport::TestCase.extend Rails::LineFiltering Rails::TestUnitReporter.executable = "bin/test" -Minitest.run_via = :rails -require "active_support/testing/autorun" + +Rails::TestUnit::Runner.parse_options(ARGV) +Rails::TestUnit::Runner.run(ARGV) -- cgit v1.2.3