Class: Ruptr::TestResult
- Inherits:
-
Object
- Object
- Ruptr::TestResult
- Defined in:
- lib/ruptr/result.rb,
lib/ruptr/runner.rb
Constant Summary collapse
- VALID_STATUSES =
NOTE: Objects of this class will get dumped/loaded with Marshal.
%i[passed skipped failed blocked].freeze
Instance Attribute Summary collapse
-
#assertions ⇒ Object
readonly
Returns the value of attribute assertions.
-
#captured_stderr ⇒ Object
readonly
Returns the value of attribute captured_stderr.
-
#captured_stdout ⇒ Object
readonly
Returns the value of attribute captured_stdout.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#ineffective_assertions ⇒ Object
readonly
Returns the value of attribute ineffective_assertions.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#system_time ⇒ Object
readonly
Returns the value of attribute system_time.
-
#user_time ⇒ Object
readonly
Returns the value of attribute user_time.
Instance Method Summary collapse
- #blocked? ⇒ Boolean
- #captured_stderr? ⇒ Boolean
- #captured_stdout? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(status, exception: nil, assertions: 0, ineffective_assertions: 0, user_time: nil, system_time: nil, captured_stdout: nil, captured_stderr: nil) ⇒ TestResult
constructor
A new instance of TestResult.
- #make_marshallable ⇒ Object
- #passed? ⇒ Boolean
- #processor_time ⇒ Object
- #skipped? ⇒ Boolean
Constructor Details
#initialize(status, exception: nil, assertions: 0, ineffective_assertions: 0, user_time: nil, system_time: nil, captured_stdout: nil, captured_stderr: nil) ⇒ TestResult
Returns a new instance of TestResult.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ruptr/result.rb', line 12 def initialize(status, exception: nil, assertions: 0, ineffective_assertions: 0, user_time: nil, system_time: nil, captured_stdout: nil, captured_stderr: nil) raise ArgumentError unless VALID_STATUSES.include?(status) raise ArgumentError if exception && status == :passed @status = status @exception = exception @assertions = assertions @ineffective_assertions = ineffective_assertions @user_time = user_time @system_time = system_time @captured_stdout = captured_stdout @captured_stderr = captured_stderr end |
Instance Attribute Details
#assertions ⇒ Object (readonly)
Returns the value of attribute assertions.
29 30 31 |
# File 'lib/ruptr/result.rb', line 29 def assertions @assertions end |
#captured_stderr ⇒ Object (readonly)
Returns the value of attribute captured_stderr.
29 30 31 |
# File 'lib/ruptr/result.rb', line 29 def captured_stderr @captured_stderr end |
#captured_stdout ⇒ Object (readonly)
Returns the value of attribute captured_stdout.
29 30 31 |
# File 'lib/ruptr/result.rb', line 29 def captured_stdout @captured_stdout end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
29 30 31 |
# File 'lib/ruptr/result.rb', line 29 def exception @exception end |
#ineffective_assertions ⇒ Object (readonly)
Returns the value of attribute ineffective_assertions.
29 30 31 |
# File 'lib/ruptr/result.rb', line 29 def ineffective_assertions @ineffective_assertions end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
29 30 31 |
# File 'lib/ruptr/result.rb', line 29 def status @status end |
#system_time ⇒ Object (readonly)
Returns the value of attribute system_time.
29 30 31 |
# File 'lib/ruptr/result.rb', line 29 def system_time @system_time end |
#user_time ⇒ Object (readonly)
Returns the value of attribute user_time.
29 30 31 |
# File 'lib/ruptr/result.rb', line 29 def user_time @user_time end |
Instance Method Details
#blocked? ⇒ Boolean
38 |
# File 'lib/ruptr/result.rb', line 38 def blocked? = @status == :blocked |
#captured_stderr? ⇒ Boolean
43 |
# File 'lib/ruptr/result.rb', line 43 def captured_stderr? = @captured_stderr && !@captured_stderr.empty? |
#captured_stdout? ⇒ Boolean
42 |
# File 'lib/ruptr/result.rb', line 42 def captured_stdout? = @captured_stdout && !@captured_stdout.empty? |
#failed? ⇒ Boolean
37 |
# File 'lib/ruptr/result.rb', line 37 def failed? = @status == :failed |
#make_marshallable ⇒ Object
81 82 83 84 85 86 87 88 |
# File 'lib/ruptr/runner.rb', line 81 def make_marshallable return unless @exception begin Marshal.dump(@exception) rescue TypeError @exception = SurrogateException.from(@exception) end end |
#passed? ⇒ Boolean
35 |
# File 'lib/ruptr/result.rb', line 35 def passed? = @status == :passed |
#processor_time ⇒ Object
40 |
# File 'lib/ruptr/result.rb', line 40 def processor_time = !@user_time ? @system_time : !@system_time ? @user_time : @user_time + @system_time |
#skipped? ⇒ Boolean
36 |
# File 'lib/ruptr/result.rb', line 36 def skipped? = @status == :skipped |