Class: Test::Result
- Inherits:
-
Object
- Object
- Test::Result
- Defined in:
- lib/rubytest/result.rb
Overview
The outcome of one test, or of a case that was skipped or raised an error.
Constant Summary collapse
- STATUSES =
[:pass, :fail, :error, :todo, :skip].freeze
- KINDS =
[:test, :case].freeze
Instance Attribute Summary collapse
-
#elapsed ⇒ Object
readonly
Returns the value of attribute elapsed.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#exceptions ⇒ Object
readonly
Returns the value of attribute exceptions.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
-
#test ⇒ Object
readonly
Returns the value of attribute test.
Instance Method Summary collapse
-
#initialize(test:, status:, kind: :test, exception: nil, reason: nil, elapsed: 0.0, stdout: '', stderr: '', exceptions: nil) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(test:, status:, kind: :test, exception: nil, reason: nil, elapsed: 0.0, stdout: '', stderr: '', exceptions: nil) ⇒ Result
Returns a new instance of Result.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rubytest/result.rb', line 9 def initialize(test:, status:, kind: :test, exception: nil, reason: nil, elapsed: 0.0, stdout: '', stderr: '', exceptions: nil) raise ArgumentError, "unknown result status: #{status.inspect}" unless STATUSES.include?(status) raise ArgumentError, "unknown result kind: #{kind.inspect}" unless KINDS.include?(kind) @test = test @kind = kind @status = status @exception = exception @exceptions = (exceptions || (exception ? [exception] : [])).dup.freeze @reason = reason @elapsed = elapsed @stdout = stdout.to_s.dup.freeze @stderr = stderr.to_s.dup.freeze freeze end |
Instance Attribute Details
#elapsed ⇒ Object (readonly)
Returns the value of attribute elapsed.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def elapsed @elapsed end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def exception @exception end |
#exceptions ⇒ Object (readonly)
Returns the value of attribute exceptions.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def exceptions @exceptions end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def kind @kind end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def reason @reason end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def status @status end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def stdout @stdout end |
#test ⇒ Object (readonly)
Returns the value of attribute test.
7 8 9 |
# File 'lib/rubytest/result.rb', line 7 def test @test end |