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:
parent
32aebc76cb
commit
a49dfe38ae
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue