Sha256: 6cd457b8a37ba7bf18fccf2d8b98d1a8206c5205da44265475408d014e836f9b

Contents?: true

Size: 790 Bytes

Versions: 2

Compression:

Stored size: 790 Bytes

Contents

# -*- coding: utf-8 -*-

require 'turnip_formatter/printer'
require 'ostruct'

module TurnipFormatter
  module Printer
    class TabSpeedStatistics
      class << self
        include TurnipFormatter::Printer

        def print_out(passed_scenarios)
          results = speed_analysis(passed_scenarios)
          render_template(:tab_speed_statistics, {analysis_results: results })
        end

        private

        def speed_analysis(scenarios)
          scenarios.map do |s|
            OpenStruct.new(
              {
                id: s.id,
                feature_name: s.feature_name,
                name: s.name,
                run_time: s.run_time
              }
            )
          end.sort { |a, b| a.run_time <=> b.run_time }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turnip_formatter-0.2.3 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.2.2 lib/turnip_formatter/printer/tab_speed_statistics.rb