Sha256: f5e895467532ceb7f14da365134334e6c4a87d94d31c5fadd1a07dadfdb22876

Contents?: true

Size: 862 Bytes

Versions: 5

Compression:

Stored size: 862 Bytes

Contents

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']
        @report[file]['all_tests_passed_last_run'] = (output == '.')
      end

      # output the report
      def testing_end
        YAML.dump(@report, @output)
        @output.close
      end
    end
  end
end


Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
ngauthier-hydra-0.24.0 lib/hydra/listener/report_generator.rb
nulogy-hydra-0.26.0 lib/hydra/listener/report_generator.rb
arturop-hydra-0.25.0 lib/hydra/listener/report_generator.rb
arturop-hydra-0.24.0 lib/hydra/listener/report_generator.rb
hydra-0.24.0 lib/hydra/listener/report_generator.rb