Sha256: ce9761f1fa0cf36dd2bf4a34731222aae496b0be68c1feffc37977c7fcc6a5d4

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 Bytes

Contents

# encoding: utf-8

require 'bundler/setup'
require 'forkforge'
require 'forkforge/knife/string'
require 'rspec/expectations'

MAX_SCENARIOS = 10
scenario_times = {}

Around() do |scenario, block|
  start = Time.now
  block.call
  scenario_times["#{scenario.feature.file}::#{scenario.name}"] = Time.now - start
end

at_exit do
  max_scenarios = scenario_times.size > MAX_SCENARIOS ? MAX_SCENARIOS : scenario_times.size
  puts '—'*20 + "  top #{max_scenarios} slowest  " + '—'*20
  sorted_times = scenario_times.sort { |a, b| b[1] <=> a[1] }
  sorted_times[0..max_scenarios - 1].each do |key, value|
    puts "#{value.round(2)}  #{key}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
forkforge-0.0.4 features/support/env.rb
forkforge-0.0.3 features/support/env.rb