Class: Dragnet::VerificationResult
- Inherits:
- 
      Object
      
        - Object
- Dragnet::VerificationResult
 
- Defined in:
- lib/dragnet/verification_result.rb
Overview
Holds the verification result of a Manual Test Record
Constant Summary collapse
- VALID_STATUSES =
- %i[passed skipped failed].freeze 
Instance Attribute Summary collapse
- 
  
    
      #finished_at  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute finished_at. 
- 
  
    
      #reason  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute reason. 
- 
  
    
      #started_at  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute started_at. 
- 
  
    
      #status  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute status. 
Instance Method Summary collapse
- #failed? ⇒ Boolean
- 
  
    
      #initialize(status:, reason: nil)  ⇒ VerificationResult 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    Creates a new instance of the class. 
- 
  
    
      #log_message  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    A string representation of the receiver that can be used to log the result of a verification. 
- #passed? ⇒ Boolean
- 
  
    
      #runtime  ⇒ Float? 
    
    
  
  
  
  
  
  
  
  
  
    The runtime calculated from the started_at and finished_at attributes, if any of them is missing nilis returned instead.
- 
  
    
      #runtime!  ⇒ Float 
    
    
  
  
  
  
  
  
  
  
  
    The runtime calculated from the started_at and finished_at timestamp attributes. 
- #skipped? ⇒ Boolean
Constructor Details
#initialize(status:, reason: nil) ⇒ VerificationResult
Creates a new instance of the class.
| 17 18 19 20 | # File 'lib/dragnet/verification_result.rb', line 17 def initialize(status:, reason: nil) self.status = status @reason = reason end | 
Instance Attribute Details
#finished_at ⇒ Object
Returns the value of attribute finished_at.
| 12 13 14 | # File 'lib/dragnet/verification_result.rb', line 12 def finished_at @finished_at end | 
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
| 12 13 14 | # File 'lib/dragnet/verification_result.rb', line 12 def reason @reason end | 
#started_at ⇒ Object
Returns the value of attribute started_at.
| 12 13 14 | # File 'lib/dragnet/verification_result.rb', line 12 def started_at @started_at end | 
#status ⇒ Object
Returns the value of attribute status.
| 12 13 14 | # File 'lib/dragnet/verification_result.rb', line 12 def status @status end | 
Instance Method Details
#failed? ⇒ Boolean
| 30 31 32 | # File 'lib/dragnet/verification_result.rb', line 30 def failed? status == :failed end | 
#log_message ⇒ String
Returns A string representation of the receiver that can be used to log the result of a verification.
| 93 94 95 96 97 98 99 100 101 | # File 'lib/dragnet/verification_result.rb', line 93 def if passed? '✔ PASSED '.colorize(:light_green) elsif skipped? "#{'⚠ SKIPPED'.colorize(:light_yellow)} #{reason}" else "#{'✘ FAILED '.colorize(:light_red)} #{reason || 'Unknown reason'}" end end | 
#passed? ⇒ Boolean
| 22 23 24 | # File 'lib/dragnet/verification_result.rb', line 22 def passed? status == :passed end | 
#runtime ⇒ Float?
Returns The runtime calculated from the started_at and finished_at attributes, if any of them is missing nil is returned instead.
| 78 79 80 81 82 | # File 'lib/dragnet/verification_result.rb', line 78 def runtime runtime! rescue Dragnet::Errors::MissingTimestampAttributeError nil end | 
#runtime! ⇒ Float
Returns The runtime calculated from the started_at and finished_at timestamp attributes.
| 87 88 89 | # File 'lib/dragnet/verification_result.rb', line 87 def runtime! @runtime ||= calculate_runtime end | 
#skipped? ⇒ Boolean
| 26 27 28 | # File 'lib/dragnet/verification_result.rb', line 26 def skipped? status == :skipped end |