Class: Reap::Test::TestResults

Inherits:
Object
  • Object
show all
Defined in:
lib/reap/task/test.rb

Overview

Support class for collecting test results.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTestResults

Returns a new instance of TestResults.



243
244
245
246
247
248
# File 'lib/reap/task/test.rb', line 243

def initialize
  @assertion_count = 0
  @run_count = 0
  @failure_count = 0
  @error_count = 0
end

Instance Attribute Details

#assertion_countObject (readonly)

Returns the value of attribute assertion_count.



241
242
243
# File 'lib/reap/task/test.rb', line 241

def assertion_count
  @assertion_count
end

#error_countObject (readonly)

Returns the value of attribute error_count.



241
242
243
# File 'lib/reap/task/test.rb', line 241

def error_count
  @error_count
end

#failure_countObject (readonly)

Returns the value of attribute failure_count.



241
242
243
# File 'lib/reap/task/test.rb', line 241

def failure_count
  @failure_count
end

#run_countObject (readonly)

Returns the value of attribute run_count.



241
242
243
# File 'lib/reap/task/test.rb', line 241

def run_count
  @run_count
end

Instance Method Details

#<<(result) ⇒ Object



250
251
252
253
254
255
# File 'lib/reap/task/test.rb', line 250

def <<( result )
  @assertion_count += result.assertion_count
  @run_count += result.run_count
  @failure_count += result.failure_count
  @error_count += result.error_count
end

#to_sObject



257
258
259
260
261
262
263
264
# File 'lib/reap/task/test.rb', line 257

def to_s
  s  = %{SUMMARY:\n\n}
  s << %{  tests      : #{@run_count}\n}
  s << %{  assertions : #{@assertion_count}\n}
  s << %{  failures   : #{@failure_count}\n}
  s << %{  errors     : #{@error_count}\n}
  s
end