lib/cucumber/formatters/pretty_formatter.rb in aslakhellesoy-cucumber-0.1.2 vs lib/cucumber/formatters/pretty_formatter.rb in aslakhellesoy-cucumber-0.1.3
- old
+ new
@@ -101,19 +101,29 @@
@io.puts
@io.puts passed("#{@passed.length} steps passed") unless @passed.empty?
@io.puts failed("#{@failed.length} steps failed") unless @failed.empty?
@io.puts skipped("#{@skipped.length} steps skipped") unless @skipped.empty?
@io.puts pending("#{@pending.length} steps pending") unless @pending.empty?
-
+ @io.print reset
+ print_snippets
+ end
+
+ def print_snippets
unless @pending.empty?
@io.puts "\nYou can use these snippets to implement pending steps:\n\n"
- @pending.each do |step|
- @io.puts "#{step.keyword} /#{step.name}/ do\nend\n\n" unless step.row?
+ prev_keyword = nil
+ snippets = @pending.map do |step|
+ next if step.row?
+ snippet = "#{step.actual_keyword} /#{step.name}/ do\nend\n\n"
+ prev_keyword = step.keyword
+ snippet
+ end.compact.uniq
+
+ snippets.each do |snippet|
+ @io.puts snippet
end
end
-
- @io.print reset
end
end
end
end
\ No newline at end of file