Class: TestTube::Experiment Private
- Inherits:
- BasicObject
- Defined in:
- lib/test_tube/experiment.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Abstract class representing the state and result of a test experiment. This class inherits from BasicObject to provide a minimal interface and avoid any method conflicts with the objects being tested.
It provides three main attributes:
-
actual: The value being tested
-
error: Any error that occurred during the test
-
got: The boolean result of the matcher
Instance Attribute Summary collapse
-
#actual ⇒ Object?
readonly
Expectation’s actual value.
-
#error ⇒ Exception?
readonly
Expectation’s raised error.
-
#got ⇒ Boolean?
readonly
Expectation’s returned boolean value.
Instance Method Summary collapse
-
#inspect ⇒ String
(also: #to_s)
A string containing a human-readable representation of the experiment.
Instance Attribute Details
#actual ⇒ Object? (readonly)
Expectation’s actual value. This represents the value that was actually produced during the test, whether it came from a direct value (Passer) or a block execution (Invoker).
29 30 31 |
# File 'lib/test_tube/experiment.rb', line 29 def actual @actual end |
#error ⇒ Exception? (readonly)
Expectation’s raised error. Stores any exception that occurred during the test execution, including system-level exceptions (SystemExit, SignalException, etc.) when using Invoker.
39 40 41 |
# File 'lib/test_tube/experiment.rb', line 39 def error @error end |
#got ⇒ Boolean? (readonly)
Expectation’s returned boolean value. The result of applying the matcher to the actual value. Will be nil if an error occurred during the test.
49 50 51 |
# File 'lib/test_tube/experiment.rb', line 49 def got @got end |
Instance Method Details
#inspect ⇒ String Also known as: to_s
A string containing a human-readable representation of the experiment. Useful for debugging and logging test results.
61 62 63 |
# File 'lib/test_tube/experiment.rb', line 61 def inspect "<TestTube actual=#{actual.inspect} error=#{error.inspect} got=#{got.inspect}>" end |