提交 b724dbbb 编写于 作者: K Kasper Timm Hansen

Use autorun when running via Rake.

Makes sure we get support for `Minitest.after_run` hooks and don't
accidentally run tests twice.

Requires overriding minitest `run` to respect the TESTOPTS variable.
上级 0dfc4675
......@@ -61,11 +61,21 @@ def self.plugin_rails_options(opts, options)
# as the patterns would also contain the other Rake tasks.
def self.rake_run(patterns) # :nodoc:
@rake_patterns = patterns
passed = run(Shellwords.split(ENV["TESTOPTS"] || ""))
exit passed unless passed
passed
autorun
end
module RunRespectingRakeTestopts
def run(args = [])
if defined?(@rake_patterns)
args = Shellwords.split(ENV["TESTOPTS"] || "")
end
super
end
end
singleton_class.prepend RunRespectingRakeTestopts
# Owes great inspiration to test runner trailblazers like RSpec,
# minitest-reporters, maxitest and others.
def self.plugin_rails_init(options)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册