Sha256: 6d8f3aeca6ace895e4f03c13bcc8d440731e4fb0b6441bcb4d7727ae435e2494
Contents?: true
Size: 1.02 KB
Versions: 51
Compression:
Stored size: 1.02 KB
Contents
module Cucumber module Formatter module Summary def scenario_summary(runtime, &block) scenarios_proc = lambda{|status| runtime.scenarios(status)} dump_count(runtime.scenarios.length, "scenario") + dump_status_counts(scenarios_proc, &block) end def step_summary(runtime, &block) steps_proc = lambda{|status| runtime.steps(status)} dump_count(runtime.steps.length, "step") + dump_status_counts(steps_proc, &block) end private def dump_status_counts(find_elements_proc) counts = [:failed, :skipped, :undefined, :pending, :passed].map do |status| elements = find_elements_proc.call(status) elements.any? ? yield("#{elements.length} #{status.to_s}", status) : nil end.compact if counts.any? " (#{counts.join(', ')})" else "" end end def dump_count(count, what, state=nil) [count, state, "#{what}#{count == 1 ? '' : 's'}"].compact.join(" ") end end end end
Version data entries
51 entries across 49 versions & 3 rubygems