Module: ActiveSupport::Testing::Performance::ForMiniTest

Defined in:
lib/active_support/testing/performance.rb

Instance Method Summary collapse

Instance Method Details

#run(runner) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/active_support/testing/performance.rb', line 45

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
    end
  end

  return
end

#run_test(metric, mode) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/active_support/testing/performance.rb', line 60

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
      teardown
      run_callbacks :teardown, :enumerator => :reverse_each
    rescue Exception => e
      result = @runner.puke(self.class, method_name, e)
    end
  end
  result
end