Sha256: e8e7991a95f5a0313037b29433b8b636896fbd9d648dcbce2fd92cf1b6fb2bcf

Contents?: true

Size: 859 Bytes

Versions: 9

Compression:

Stored size: 859 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(scenarios)
          passed_scenarios = scenarios.select { |s| s.status == 'passed' }
          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

9 entries across 9 versions & 1 rubygems

Version Path
turnip_formatter-0.6.0.pre.beta.2 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.6.0.pre.beta.1 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.5.0 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.4.0 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.3.4 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.3.3 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.3.2 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.3.1 lib/turnip_formatter/printer/tab_speed_statistics.rb
turnip_formatter-0.3.0 lib/turnip_formatter/printer/tab_speed_statistics.rb