Class: SimpleFileReport

Inherits:
Object
  • Object
show all
Defined in:
lib/SimpleFileReport.rb

Overview

Appends colon-separed results to a report file.

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ SimpleFileReport

Returns a new instance of SimpleFileReport.



8
9
10
# File 'lib/SimpleFileReport.rb', line 8

def initialize(file)
  @file = file
end

Instance Method Details

#done(tests_ok, tests_fail) ⇒ Object



19
20
21
22
23
24
# File 'lib/SimpleFileReport.rb', line 19

def done(tests_ok, tests_fail)
  line = "#{Time.now.to_i}:DONE:#{tests_ok}:#{tests_fail}"
  file = File.new(@file, "a")
  file.puts(line)
  file.close()
end

#log(status, duration, service, api, name, message) ⇒ Object



12
13
14
15
16
17
# File 'lib/SimpleFileReport.rb', line 12

def log(status, duration, service, api, name, message)
  line = "#{Time.now.to_i}:#{status}:#{duration}:#{service}:#{api}:#{name}:#{message}"
  file = File.new(@file, "a")
  file.puts(line)
  file.close()
end