added listener documentation

This commit is contained in:
Nick Gauthier 2010-03-25 12:21:26 -04:00
parent 2f2919c156
commit 665c1265cc
2 changed files with 9 additions and 0 deletions

View File

@ -4,14 +4,18 @@ module Hydra #:nodoc:
# of testing and outputs a ./F/E per file. As well as
# full error output, if any.
class MinimalOutput < Hydra::Listener::Abstract
# output a starting message
def testing_begin(files)
@output.write "Hydra Testing:\n#{files.inspect}\n"
end
# output a finished message
def testing_end
@output.write "\nHydra Completed\n"
end
# For each file, just output a . for a successful file, or the
# Failure/Error output from the tests
def file_end(file, output)
@output.write output
end

View File

@ -2,20 +2,25 @@ module Hydra #:nodoc:
module Listener #:nodoc:
# Output a textual report at the end of testing
class ReportGenerator < Hydra::Listener::Abstract
# Initialize a new report
def testing_begin(files)
@report = { }
end
# Log the start time of a file
def file_begin(file)
@report[file] ||= { }
@report[file]['start'] = Time.now.to_f
end
# Log the end time of a file and compute the file's testing
# duration
def file_end(file, output)
@report[file]['end'] = Time.now.to_f
@report[file]['duration'] = @report[file]['end'] - @report[file]['start']
end
# output the report
def testing_end
YAML.dump(@report, @output)
@output.close