Class: Grntest::TestResult

Inherits:
BaseResult show all
Defined in:
lib/grntest/test-runner.rb

Instance Attribute Summary collapse

Attributes inherited from BaseResult

#elapsed_time

Instance Method Summary collapse

Methods inherited from BaseResult

#measure

Constructor Details

#initialize(worker) ⇒ TestResult

Returns a new instance of TestResult.



35
36
37
38
39
40
41
42
43
# File 'lib/grntest/test-runner.rb', line 35

def initialize(worker)
  super()
  @worker_id = worker.id
  @test_name = worker.test_name
  @actual = nil
  @expected = nil
  @n_leaked_objects = 0
  @omitted = false
end

Instance Attribute Details

#actualObject

Returns the value of attribute actual.



33
34
35
# File 'lib/grntest/test-runner.rb', line 33

def actual
  @actual
end

#expectedObject

Returns the value of attribute expected.



33
34
35
# File 'lib/grntest/test-runner.rb', line 33

def expected
  @expected
end

#n_leaked_objectsObject

Returns the value of attribute n_leaked_objects.



33
34
35
# File 'lib/grntest/test-runner.rb', line 33

def n_leaked_objects
  @n_leaked_objects
end

#omitted=(value) ⇒ Object (writeonly)

Sets the attribute omitted

Parameters:

  • value

    the value to set the attribute omitted to.



34
35
36
# File 'lib/grntest/test-runner.rb', line 34

def omitted=(value)
  @omitted = value
end

#test_nameObject

Returns the value of attribute test_name.



32
33
34
# File 'lib/grntest/test-runner.rb', line 32

def test_name
  @test_name
end

#worker_idObject

Returns the value of attribute worker_id.



32
33
34
# File 'lib/grntest/test-runner.rb', line 32

def worker_id
  @worker_id
end

Instance Method Details

#checked?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/grntest/test-runner.rb', line 75

def checked?
  not @expected.nil?
end

#leaked?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/grntest/test-runner.rb', line 71

def leaked?
  not @n_leaked_objects.zero?
end

#omitted?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/grntest/test-runner.rb', line 67

def omitted?
  @omitted
end

#statusObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/grntest/test-runner.rb', line 45

def status
  return :omitted if omitted?

  if @expected
    if @actual == @expected
      if leaked?
        :leaked
      else
        :success
      end
    else
      :failure
    end
  else
    if leaked?
      :leaked
    else
      :not_checked
    end
  end
end