module Cucumber module Formatters class HtmlFormatter def initialize(io) @io = io @errors = [] end def visit_features(features) # IMPORTANT NOTICE ABOUT JQUERY BELOW. THE ORIGINAL BACKSLASHES (\) HAVE # BEEN REPLACED BY DOUBLE BACKSLASHES (\\) IN THIS FILE TO MAKE SURE THEY # ARE PRINTED PROPERLY WITH ONLY ONE BACKSLASH (\). @io.puts(<<-HTML) Stories
HTML features.accept(self) @io.puts "
" end def visit_feature(feature) @io.puts "
" feature.accept(self) @io.puts " " @io.puts "
" end def visit_header(header) @io.puts "
Feature: #{header}
" end # TODO: Lose me def visit_narrative(narrative) @io.puts "
" @io.puts "

" @io.puts narrative.gsub(/\n/, "
\n") @io.puts "

" end def visit_scenario(scenario) @io.puts "
" @io.puts "
Scenario: #{scenario.name}
" @io.puts "
" @io.puts "
    " scenario.accept(self) @io.puts "
" @io.puts "
" @io.puts "
" end def visit_step(step) @io.puts "
  • #{step.keyword} #{step.gzub('%s')}
  • " end def step_executed(step) js = case(step.error) when Pending "stepPending(#{step.id})" when NilClass "stepPassed(#{step.id})" else @errors << step.error "stepFailed(#{step.id}, ().toString(), ().toString())" end @io.puts " " end def step_skipped(step) # noop end def dump @io.puts <<-HTML HTML end end end end