Module: Turnip::StepProfiler::Define

Defined in:
lib/turnip/step_profiler.rb

Instance Method Summary collapse

Instance Method Details

#run_step(feature_file, step) ⇒ Object



83
84
85
86
# File 'lib/turnip/step_profiler.rb', line 83

def run_step(feature_file, step)
  Thread.current['current_file'] = feature_file
  super
end

#step(step) ⇒ Object



72
73
74
75
76
77
78
79
80
81
# File 'lib/turnip/step_profiler.rb', line 72

def step(step)
  s = Time.now
  super
  e = Time.now
  desc = step.class == String ? step : step.description

  if (step_profiler = Thread.current[:step_profiler])
    step_profiler.steps[desc] << StepExecute.new(file: Thread.current['current_file'], time: e - s)
  end
end