disu.se

ContextClass

Namespace

Lookout::Expect::Object

Ancestors
  1. Object

Context in which expect blocks are evaluated. Plug-ins may add private methods to this class to make them available to expect blocks.

Constructor

initialize(*args::Object*, &blockProc)#

Evaluates block inside this context, passing args to it, when #evaluated.

Instance Methods

evaluate::Object?#

Returns the result of evaluating the block or nil if there’s no block.

stub(object::Object, methodsHash<Symbol,Object>){ |object::Object| … }private#

Sets up stubs on object for each method name key in methods to its value definition during the execution of the given block. If the value of the key is a Proc it’ll be used as the method definition. Otherwise, the method definition will be set up to return the value.

Returns::Object

The result of the block

stub(methodsHash<Symbol,::Object> = {})Lookout::Stub::Objectprivate#

Returns a stub object set up with methods.

with_global(globalSymbol, value::Object){ |overridden::Object| … }private#

Sets global to value during the execution of the given block, yielding the overridden value.

Returns::Object

The result of the block

RaisesArgumentError

If global isn’t the name of a global variable

with_verbose(verbosetrue, false, nil = true){ … }private#

Sets $VERBOSE to verbose during the execution of the given block.

Returns::Object

The result of the block

with_const(nameString, value::Object){ … }private#

Sets the constant identified by (the possibly qualified) name to value during the execution of the given block. If name is qualified, any intermediate modules that aren’t defined will be set to new Modules. These modules will be removed once the block returns.

Returns::Object

The result of the block

RaisesNameError

with_env(envHash = {}){ … }private#

Sets environment variables defined in env during the execution of the given block.

Returns::Object

The result of the block