Skip to content

Commit a49dfe3

Browse files
committedJun 13, 2020
Introduce Rails::TestUnitReporter.app_root to inject app_root when needed.
1 parent 32aebc7 commit a49dfe3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎railties/lib/rails/test_unit/reporter.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
module Rails
77
class TestUnitReporter < Minitest::StatisticsReporter
8+
class_attribute :app_root
89
class_attribute :executable, default: "rails test"
910

1011
def record(result)
@@ -79,11 +80,9 @@ def format_rerun_snippet(result)
7980
end
8081

8182
def app_root
82-
@app_root ||=
83+
@app_root ||= self.class.app_root ||
8384
if defined?(ENGINE_ROOT)
8485
ENGINE_ROOT
85-
elsif defined?(COMPONENT_ROOT)
86-
COMPONENT_ROOT
8786
elsif Rails.respond_to?(:root)
8887
Rails.root
8988
end

‎tools/test.rb

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
require "active_support/test_case"
1313

1414
ActiveSupport::TestCase.extend Rails::LineFiltering
15+
Rails::TestUnitReporter.app_root = COMPONENT_ROOT
1516
Rails::TestUnitReporter.executable = "bin/test"
1617

1718
Rails::TestUnit::Runner.parse_options(ARGV)

0 commit comments

Comments
 (0)