class Assert
Represents a single assertion result.
Definitions
def initialize(identity, backtrace, assertions)
Initialize a new assertion result.
Signature
-
parameter
identityIdentity, nil The identity of the assertion.
-
parameter
backtraceArray The backtrace where the assertion was made.
-
parameter
assertionsAssertions The assertions instance that contains this assertion.
Implementation
def initialize(identity, backtrace, assertions)
@identity = identity
@backtrace = backtrace
@assertions = assertions
end
attr :identity
Signature
-
attribute
Identity, nil The identity of the assertion.
attr :backtrace
Signature
-
attribute
Array The backtrace where the assertion was made.
attr :assertions
Signature
-
attribute
Assertions The assertions instance that contains this assertion.
def each_failure(&block)
Signature
-
yields
{|assert| ...} Yields this assertion as a failure.
Implementation
def each_failure(&block)
yield self
end
def message
Signature
-
returns
Hash A hash containing the output text and location of the assertion.
Implementation
def message
{
# It's possible that several Assert instances might share the same output text. This is because the output is buffered for each test and each top-level test expectation.
text: @assertions.output.string,
location: @identity&.to_location
}
end