Class: TestResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, filename) ⇒ TestResults

Returns a new instance of TestResults.



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

def initialize(query, filename)
  @modules    = query['modules'].to_i
  @tests      = query['tests'].to_i
  @assertions = query['assertions'].to_i
  @failures   = query['failures'].to_i
  @errors     = query['errors'].to_i
  @filename   = filename
end

Instance Attribute Details

#assertionsObject (readonly)

Returns the value of attribute assertions.



2
3
4
# File 'lib/hanoi/test_results.rb', line 2

def assertions
  @assertions
end

#errorsObject (readonly)

Returns the value of attribute errors.



2
3
4
# File 'lib/hanoi/test_results.rb', line 2

def errors
  @errors
end

#failuresObject (readonly)

Returns the value of attribute failures.



2
3
4
# File 'lib/hanoi/test_results.rb', line 2

def failures
  @failures
end

#filenameObject (readonly)

Returns the value of attribute filename.



2
3
4
# File 'lib/hanoi/test_results.rb', line 2

def filename
  @filename
end

#modulesObject (readonly)

Returns the value of attribute modules.



2
3
4
# File 'lib/hanoi/test_results.rb', line 2

def modules
  @modules
end

#testsObject (readonly)

Returns the value of attribute tests.



2
3
4
# File 'lib/hanoi/test_results.rb', line 2

def tests
  @tests
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/hanoi/test_results.rb', line 12

def error?
  @errors > 0
end

#failure?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/hanoi/test_results.rb', line 16

def failure?
  @failures > 0
end

#to_sObject



20
21
22
23
24
# File 'lib/hanoi/test_results.rb', line 20

def to_s
  return "E" if error?
  return "F" if failure?
  "."
end