module MiddlewareContext
A test context for exercising protocol HTTP middleware in-process.
Definitions
def middleware
The middleware under test.
Signature
-
returns
::Protocol::HTTP::Middleware The middleware.
Implementation
def middleware
::Protocol::HTTP::Middleware::HelloWorld
end
def client
The in-process client for the application.
Signature
-
returns
Client The client.
Implementation
def client
@client ||= Client.new(middleware)
end
def last_request
The most recent request.
Signature
-
returns
::Protocol::HTTP::Request | Nil The request.
Implementation
def last_request
client.last_request
end
def last_response
The most recent response.
Signature
-
returns
::Protocol::HTTP::Response | Nil The response.
Implementation
def last_response
client.last_response
end
def after(error = nil)
Close the client after each test.
Signature
-
parameter
errorException | Nil The error raised by the test, if any.
Implementation
def after(error = nil)
begin
@client&.close(error)
ensure
super
end
end