class Cucumber::Formatter::ConsoleCounts
Public Class Methods
new(config)
click to toggle source
# File lib/cucumber/formatter/console_counts.rb, line 8 def initialize(config) @summary = Core::Report::Summary.new(config.event_bus) end
Public Instance Methods
to_s()
click to toggle source
# File lib/cucumber/formatter/console_counts.rb, line 12 def to_s [ [scenario_count, status_counts(@summary.test_cases)].compact.join(' '), [step_count, status_counts(@summary.test_steps)].compact.join(' ') ].join("\n") end
Private Instance Methods
scenario_count()
click to toggle source
# File lib/cucumber/formatter/console_counts.rb, line 21 def scenario_count count = @summary.test_cases.total "#{count} scenario" + (count == 1 ? '' : 's') end
status_counts(summary)
click to toggle source
# File lib/cucumber/formatter/console_counts.rb, line 31 def status_counts(summary) counts = Core::Test::Result::TYPES.map do |status| count = summary.total(status) [status, count] end.select do |status, count| count > 0 end.map do |status, count| format_string("#{count} #{status}", status) end "(#{counts.join(", ")})" if counts.any? end
step_count()
click to toggle source
# File lib/cucumber/formatter/console_counts.rb, line 26 def step_count count = @summary.test_steps.total "#{count} step" + (count == 1 ? '' : 's') end