Introduce Rails::TestUnitReporter.app_root to inject app_root when needed.
This commit is contained in:
parent
32aebc76cb
commit
a49dfe38ae
|
@ -5,6 +5,7 @@ require "minitest"
|
||||||
|
|
||||||
module Rails
|
module Rails
|
||||||
class TestUnitReporter < Minitest::StatisticsReporter
|
class TestUnitReporter < Minitest::StatisticsReporter
|
||||||
|
class_attribute :app_root
|
||||||
class_attribute :executable, default: "rails test"
|
class_attribute :executable, default: "rails test"
|
||||||
|
|
||||||
def record(result)
|
def record(result)
|
||||||
|
@ -79,11 +80,9 @@ module Rails
|
||||||
end
|
end
|
||||||
|
|
||||||
def app_root
|
def app_root
|
||||||
@app_root ||=
|
@app_root ||= self.class.app_root ||
|
||||||
if defined?(ENGINE_ROOT)
|
if defined?(ENGINE_ROOT)
|
||||||
ENGINE_ROOT
|
ENGINE_ROOT
|
||||||
elsif defined?(COMPONENT_ROOT)
|
|
||||||
COMPONENT_ROOT
|
|
||||||
elsif Rails.respond_to?(:root)
|
elsif Rails.respond_to?(:root)
|
||||||
Rails.root
|
Rails.root
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,7 @@ require "active_support"
|
||||||
require "active_support/test_case"
|
require "active_support/test_case"
|
||||||
|
|
||||||
ActiveSupport::TestCase.extend Rails::LineFiltering
|
ActiveSupport::TestCase.extend Rails::LineFiltering
|
||||||
|
Rails::TestUnitReporter.app_root = COMPONENT_ROOT
|
||||||
Rails::TestUnitReporter.executable = "bin/test"
|
Rails::TestUnitReporter.executable = "bin/test"
|
||||||
|
|
||||||
Rails::TestUnit::Runner.parse_options(ARGV)
|
Rails::TestUnit::Runner.parse_options(ARGV)
|
||||||
|
|
Loading…
Reference in New Issue