Class: Simmer::Suite::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/simmer/suite/result.rb

Overview

The return object for a Session#run call.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runner_results = []) ⇒ Result

Returns a new instance of Result.



16
17
18
19
20
# File 'lib/simmer/suite/result.rb', line 16

def initialize(runner_results = [])
  @runner_results = Array(runner_results)

  freeze
end

Instance Attribute Details

#runner_resultsObject (readonly)

Returns the value of attribute runner_results.



14
15
16
# File 'lib/simmer/suite/result.rb', line 14

def runner_results
  @runner_results
end

Instance Method Details

#fail?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/simmer/suite/result.rb', line 27

def fail?
  runner_results.any?(&:fail?)
end

#pass?Boolean Also known as: passing?

Returns:

  • (Boolean)


22
23
24
# File 'lib/simmer/suite/result.rb', line 22

def pass?
  !fail?
end

#time_in_secondsObject



31
32
33
34
35
# File 'lib/simmer/suite/result.rb', line 31

def time_in_seconds
  runner_results.inject(0.0) do |memo, runner_result|
    memo + runner_result.time_in_seconds
  end
end

#to_hObject



37
38
39
40
41
42
43
# File 'lib/simmer/suite/result.rb', line 37

def to_h
  {
    'pass' => pass?,
    'time_in_seconds' => time_in_seconds,
    'runner_results' => runner_results.map(&:to_h)
  }
end