1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Introduce Rails::TestUnitReporter.app_root to inject app_root when needed.

This commit is contained in:
Josef Šimánek 2020-06-14 00:00:14 +02:00
parent 32aebc76cb
commit a49dfe38ae
No known key found for this signature in database
GPG key ID: 375E76A19719F67B
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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)