Class: Riot::AllImportantMiddleware

Inherits:
ContextMiddleware show all
Defined in:
lib/riot/middleware.rb

Overview

Special middleware used by Context directly. It will always be the last in the chain and is the actual place where the user’s runtime context is processed.

Instance Attribute Summary

Attributes inherited from ContextMiddleware

#middleware

Instance Method Summary collapse

Methods inherited from ContextMiddleware

register

Constructor Details

#initialize(&context_definition) ⇒ AllImportantMiddleware

Returns a new instance of AllImportantMiddleware.



97
98
99
# File 'lib/riot/middleware.rb', line 97

def initialize(&context_definition)
  @context_definition = context_definition
end

Instance Method Details

#call(context) ⇒ Object

The magic happens here. Because you have access to the Context, you can add your own setups, hookups, etc. call will be called before any tests are run, but after the Context is configured. Though something will likely be returned, do not put any faith in what that will be.

Parameters:

  • context (Riot::Context)

    the Context instance that will be prepared by registered middleware



102
# File 'lib/riot/middleware.rb', line 102

def call(context) context.instance_eval(&@context_definition); end