disu.se

ObjectClass

Namespace

Lookout::Expect

Ancestors
  1. Value

  2. Value::Comparable

  3. Comparable

  4. Object

Subclasses
Classes::Exception

Expect block of Expected::Classes::Exceptions.

Exception

Expect block of Expected::Exceptions.

Expect block of Expected::Objects. This is the base expect block class and may be subclassed if some special equality checking needs to be performed, if the execution environment needs to be set up in some way before the expect block is executed, or if the expect block should receive other arguments than the default (being the expected value).

Children

Context

Context in which expect blocks are evaluated.

Constructor

initialize(expectedExpected::Object, file::String, line::Integer){ |expected::Object|::Object … }#

Sets up the expect block on line in file (the expanded path) to expect the value that expected wraps, and using the block’s result as the actual result to pass to Expected::Object#difference when #called.

Note

Comparisons between instances are made between file and line.

Instance Methods

call#

Evaluates the expect block and checks for differences between its result and the expected value.

Returns
Results::Error

If an Exception is raised

Results::Success

If there are no differences between the actual result and the expected value

Results::Failure

If there are differences between the actual result and the expected value

evaluate_block(*args::Object*)::Objectprivate#

Returns the actual result of evaluating the expect block in the proper context, passing args, which defaults to the expected value, to it.

See Also

Context

check(actual::Object)private#

Checks for differences between the actual result of evaluating the expect block and the expected value.

Returns
Results::Success

If there are no differences between the actual result and the expected value

Results::Failure

If there are differences between the actual result and the expected value

expectedExpected::Objectprotected#

Returns the expected value wrapper.

file::Stringprotected#

Returns the expanded path to the file containing the expectation.

line::Integerprotected#

Returns the line in #file on which the expectation is defined.