diff options
Diffstat (limited to 'activesupport/lib/active_support/testing')
-rw-r--r-- | activesupport/lib/active_support/testing/isolation.rb | 22 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/pending.rb | 20 | ||||
-rw-r--r-- | activesupport/lib/active_support/testing/performance.rb | 47 |
3 files changed, 30 insertions, 59 deletions
diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb index 5d5de4798d..1a0681e850 100644 --- a/activesupport/lib/active_support/testing/isolation.rb +++ b/activesupport/lib/active_support/testing/isolation.rb @@ -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 diff --git a/activesupport/lib/active_support/testing/pending.rb b/activesupport/lib/active_support/testing/pending.rb deleted file mode 100644 index 510f80f32c..0000000000 --- a/activesupport/lib/active_support/testing/pending.rb +++ /dev/null @@ -1,20 +0,0 @@ -# Some code from jeremymcanally's "pending" -# https://github.com/jeremymcanally/pending/tree/master - -module ActiveSupport - module Testing - module Pending - - unless defined?(Spec) - - @@pending_cases = [] - @@at_exit = false - - def pending(description = "", &block) - skip(description.blank? ? nil : description) - end - end - - end - end -end diff --git a/activesupport/lib/active_support/testing/performance.rb b/activesupport/lib/active_support/testing/performance.rb index 209bfac19f..244ee1a224 100644 --- a/activesupport/lib/active_support/testing/performance.rb +++ b/activesupport/lib/active_support/testing/performance.rb @@ -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 |