From a49dfe38aed579581e65f675a13b6d8b6b94e3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=A0im=C3=A1nek?= Date: Sun, 14 Jun 2020 00:00:14 +0200 Subject: [PATCH] Introduce Rails::TestUnitReporter.app_root to inject app_root when needed. --- railties/lib/rails/test_unit/reporter.rb | 5 ++--- tools/test.rb | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/test_unit/reporter.rb b/railties/lib/rails/test_unit/reporter.rb index dcf28e4d14..f36685da4b 100644 --- a/railties/lib/rails/test_unit/reporter.rb +++ b/railties/lib/rails/test_unit/reporter.rb @@ -5,6 +5,7 @@ require "minitest" module Rails class TestUnitReporter < Minitest::StatisticsReporter + class_attribute :app_root class_attribute :executable, default: "rails test" def record(result) @@ -79,11 +80,9 @@ module Rails end def app_root - @app_root ||= + @app_root ||= self.class.app_root || if defined?(ENGINE_ROOT) ENGINE_ROOT - elsif defined?(COMPONENT_ROOT) - COMPONENT_ROOT elsif Rails.respond_to?(:root) Rails.root end diff --git a/tools/test.rb b/tools/test.rb index 19bd980723..b40b83e52a 100644 --- a/tools/test.rb +++ b/tools/test.rb @@ -12,6 +12,7 @@ require "active_support" require "active_support/test_case" ActiveSupport::TestCase.extend Rails::LineFiltering +Rails::TestUnitReporter.app_root = COMPONENT_ROOT Rails::TestUnitReporter.executable = "bin/test" Rails::TestUnit::Runner.parse_options(ARGV)