Module: Cukeregator::SummaryFormatter

Extended by:
SummaryFormatter
Included in:
SummaryFormatter
Defined in:
lib/cukeregator/aggregator.rb

Instance Method Summary collapse

Instance Method Details

#count(which) ⇒ Object



4
5
6
7
# File 'lib/cukeregator/aggregator.rb', line 4

def count(which)
  total = yield("total_#{which}s".to_sym)
  "#{total} #{which}#{'s' if total> 1}"
end

#duration_inner_html(s) ⇒ Object



22
23
24
# File 'lib/cukeregator/aggregator.rb', line 22

def duration_inner_html(s)
  "Combined Duration <strong>#{s}</strong>"
end

#status_counts(which) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/cukeregator/aggregator.rb', line 15

def status_counts(which)
  totals = yield("#{which}_totals".to_sym)
  counts = [:failed, :skipped, :undefined, :pending, :passed].map do |status|
    "#{totals[status]} #{status}" if totals[status] > 0
  end.compact
  " (#{counts.join(', ')})"
end

#totals_inner_html(&block) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/cukeregator/aggregator.rb', line 8

def totals_inner_html(&block)
  totals = count(:scenario, &block) 
  totals += status_counts(:scenario, &block)
  totals += "<br />"
  totals += count(:step, &block)
  totals += status_counts(:step, &block)
end