mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
no need in separate MiniTest modules
This commit is contained in:
parent
6a88302a5f
commit
9cb00a465f
2 changed files with 30 additions and 39 deletions
|
@ -37,10 +37,6 @@ module ActiveSupport
|
|||
!ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
|
||||
end
|
||||
|
||||
def self.included(base)
|
||||
base.send :include, MiniTest
|
||||
end
|
||||
|
||||
def _run_class_setup # class setup method should only happen in parent
|
||||
unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
|
||||
self.class.setup if self.class.respond_to?(:setup)
|
||||
|
@ -48,18 +44,16 @@ module ActiveSupport
|
|||
end
|
||||
end
|
||||
|
||||
module MiniTest
|
||||
def run(runner)
|
||||
_run_class_setup
|
||||
def run(runner)
|
||||
_run_class_setup
|
||||
|
||||
serialized = run_in_isolation do |isolated_runner|
|
||||
super(isolated_runner)
|
||||
end
|
||||
|
||||
retval, proxy = Marshal.load(serialized)
|
||||
proxy.__replay__(runner)
|
||||
retval
|
||||
serialized = run_in_isolation do |isolated_runner|
|
||||
super(isolated_runner)
|
||||
end
|
||||
|
||||
retval, proxy = Marshal.load(serialized)
|
||||
proxy.__replay__(runner)
|
||||
retval
|
||||
end
|
||||
|
||||
module Forking
|
||||
|
|
|
@ -13,7 +13,6 @@ module ActiveSupport
|
|||
included do
|
||||
superclass_delegating_accessor :profile_options
|
||||
self.profile_options = {}
|
||||
include ForMiniTest
|
||||
end
|
||||
|
||||
# each implementation should define metrics and freeze the defaults
|
||||
|
@ -36,40 +35,38 @@ module ActiveSupport
|
|||
"#{self.class.name}##{method_name}"
|
||||
end
|
||||
|
||||
module ForMiniTest
|
||||
def run(runner)
|
||||
@runner = runner
|
||||
def run(runner)
|
||||
@runner = runner
|
||||
|
||||
run_warmup
|
||||
if full_profile_options && metrics = full_profile_options[:metrics]
|
||||
metrics.each do |metric_name|
|
||||
if klass = Metrics[metric_name.to_sym]
|
||||
run_profile(klass.new)
|
||||
end
|
||||
run_warmup
|
||||
if full_profile_options && metrics = full_profile_options[:metrics]
|
||||
metrics.each do |metric_name|
|
||||
if klass = Metrics[metric_name.to_sym]
|
||||
run_profile(klass.new)
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
def run_test(metric, mode)
|
||||
result = '.'
|
||||
return
|
||||
end
|
||||
|
||||
def run_test(metric, mode)
|
||||
result = '.'
|
||||
begin
|
||||
run_callbacks :setup
|
||||
setup
|
||||
metric.send(mode) { __send__ method_name }
|
||||
rescue Exception => e
|
||||
result = @runner.puke(self.class, method_name, e)
|
||||
ensure
|
||||
begin
|
||||
run_callbacks :setup
|
||||
setup
|
||||
metric.send(mode) { __send__ method_name }
|
||||
teardown
|
||||
run_callbacks :teardown, :enumerator => :reverse_each
|
||||
rescue Exception => e
|
||||
result = @runner.puke(self.class, method_name, e)
|
||||
ensure
|
||||
begin
|
||||
teardown
|
||||
run_callbacks :teardown, :enumerator => :reverse_each
|
||||
rescue Exception => e
|
||||
result = @runner.puke(self.class, method_name, e)
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
Loading…
Reference in a new issue