Class: Drntest::TestResults

Inherits:
Object
  • Object
show all
Defined in:
lib/drntest/test-results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ TestResults

Returns a new instance of TestResults.



21
22
23
24
25
26
27
28
# File 'lib/drntest/test-results.rb', line 21

def initialize(name)
  @name = name
  @actuals = []
  @expecteds = []
  @errors = []
  @omitted = false
  @omit_message = nil
end

Instance Attribute Details

#actualsObject

Returns the value of attribute actuals.



18
19
20
# File 'lib/drntest/test-results.rb', line 18

def actuals
  @actuals
end

#errorsObject

Returns the value of attribute errors.



18
19
20
# File 'lib/drntest/test-results.rb', line 18

def errors
  @errors
end

#expectedsObject

Returns the value of attribute expecteds.



18
19
20
# File 'lib/drntest/test-results.rb', line 18

def expecteds
  @expecteds
end

#nameObject

Returns the value of attribute name.



18
19
20
# File 'lib/drntest/test-results.rb', line 18

def name
  @name
end

#omit_messageObject (readonly)

Returns the value of attribute omit_message.



19
20
21
# File 'lib/drntest/test-results.rb', line 19

def omit_message
  @omit_message
end

Instance Method Details

#omit(message) ⇒ Object



43
44
45
46
# File 'lib/drntest/test-results.rb', line 43

def omit(message)
  @omitted = true
  @omit_message = message
end

#statusObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/drntest/test-results.rb', line 30

def status
  return :omitted if @omitted
  return :error unless @errors.empty?
  return :no_response if @actuals.empty?
  return :not_checked if @expecteds.empty?

  if @actuals == @expecteds
    :success
  else
    :failure
  end
end