Sha256: d8dff1135504e685eecb3040d46d039b5e07c569c9dd58838bc1c5eec970b53e
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
# -*- coding: utf-8 -*- require 'turnip_formatter/printer' require 'ostruct' module TurnipFormatter module Printer module TabFeatureStatistics class << self include TurnipFormatter::Printer def print_out(scenarios) features = scenarios.group_by { |s| s.feature_name } results = features.map do |name, feature_scenarios| feature_analysis(name, feature_scenarios) end render_template(:tab_feature_statistics, {analysis_results: results }) end private def feature_analysis(name, scenarios) status_group = scenarios.group_by { |s| s.status } info = OpenStruct.new( name: name, scenarios: scenarios.count, passed: status_count(status_group["passed"]), failed: status_count(status_group["failed"]), pending: status_count(status_group["pending"]), status: 'failed' ) info.status = (info.pending.zero? ? 'passed' : 'pending') if info.failed.zero? info end def status_count(scenarios) scenarios.nil? ? 0 : scenarios.count 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_feature_statistics.rb |
turnip_formatter-0.2.2 | lib/turnip_formatter/printer/tab_feature_statistics.rb |