Class: TestSuiteResults

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

Instance Method Summary collapse

Constructor Details

#initializeTestSuiteResults

Returns a new instance of TestSuiteResults.



2
3
4
5
6
7
# File 'lib/zfben_hanoi/test_suite_results.rb', line 2

def initialize
  @total = 0
  @passed = 0
  @failed = 0
  @failed_files = []
end

Instance Method Details

#<<(result) ⇒ Object



9
10
11
12
13
14
# File 'lib/zfben_hanoi/test_suite_results.rb', line 9

def <<(result)
  @total += result.total
  @passed += result.passed
  @failed += result.failed
  @failed_files.push(result.filename) if result.failed?
end

#failed?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/zfben_hanoi/test_suite_results.rb', line 16

def failed?
  @failed > 0
end

#summaryObject



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

def summary
  "#{@total} tests, #{@passed} passed, #{@failed} failed."
end

#to_sObject



20
21
22
23
24
# File 'lib/zfben_hanoi/test_suite_results.rb', line 20

def to_s
  str = ""
  str << "\n  Filed: #{@failed_files.join(', ')}" if failed?
  "#{str}\n#{summary}\n\n"
end