Class: Kapnismology::Result

Inherits:
BaseResult show all
Defined in:
lib/kapnismology/result.rb

Overview

This is the result of each smoke test. This class makes sense to enforce smoke test to return something known Params of the constructor:

  • passed : Boolean: true -> test passed, false -> test failed

  • data : Hash representing the result of the test

  • message: String with an extra message to provide human readable information

Direct Known Subclasses

SmokeTest::Result

Instance Attribute Summary

Attributes inherited from BaseResult

#data, #debug_messages, #duration, #message

Instance Method Summary collapse

Methods inherited from BaseResult

#add_debug_messages, #passed?, #record_duration, #to_hash, #to_s

Constructor Details

#initialize(passed, data, message) ⇒ Result

Returns a new instance of Result.

Raises:

  • (ArgumentError)


59
60
61
62
63
64
65
66
67
68
# File 'lib/kapnismology/result.rb', line 59

def initialize(passed, data, message)
  raise ArgumentError, 'passed argument must be true or false' unless !!passed == passed
  raise ArgumentError, 'data argument must be a hash' unless data.is_a?(Hash)

  @passed = passed
  @data = data
  @message = message
  @debug_messages = []
  @duration = 0
end