Class: TestSuiteResults

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

Instance Method Summary collapse

Constructor Details

#initializeTestSuiteResults

Returns a new instance of TestSuiteResults.



2
3
4
5
6
7
8
9
10
# File 'lib/hanoi/test_suite_results.rb', line 2

def initialize
  @modules    = 0
  @tests      = 0
  @assertions = 0
  @failures   = 0
  @errors     = 0
  @error_files   = []
  @failure_files = []
end

Instance Method Details

#<<(result) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/hanoi/test_suite_results.rb', line 12

def <<(result)
  @modules    += result.modules
  @tests      += result.tests
  @assertions += result.assertions
  @failures   += result.failures
  @errors     += result.errors
  @error_files.push(result.filename)   if result.error?
  @failure_files.push(result.filename) if result.failure?
end

#error?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/hanoi/test_suite_results.rb', line 22

def error?
  @errors > 0
end

#failure?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/hanoi/test_suite_results.rb', line 26

def failure?
  @failures > 0
end

#summaryObject



37
38
39
# File 'lib/hanoi/test_suite_results.rb', line 37

def summary
  "#{@modules} modules, #{@tests} tests, #{@assertions} assertions, #{@failures} failures, #{@errors} errors."
end

#to_sObject



30
31
32
33
34
35
# File 'lib/hanoi/test_suite_results.rb', line 30

def to_s
  str = ""
  str << "\n  Failures: #{@failure_files.join(', ')}" if failure?
  str << "\n  Errors:   #{@error_files.join(', ')}" if error?
  "#{str}\n#{summary}\n\n"
end