Module: Sus::Fixtures::Protocol::HTTP::MiddlewareContext

Defined in:
lib/sus/fixtures/protocol/http/middleware_context.rb

Overview

A test context for exercising protocol HTTP middleware in-process.

Instance Method Summary collapse

Instance Method Details

#after(error = nil) ⇒ Object

Close the client after each test.



46
47
48
49
50
51
52
# File 'lib/sus/fixtures/protocol/http/middleware_context.rb', line 46

def after(error = nil)
	begin
		@client&.close(error)
	ensure
		super
	end
end

#clientObject

The in-process client for the application.



25
26
27
# File 'lib/sus/fixtures/protocol/http/middleware_context.rb', line 25

def client
	@client ||= Client.new(middleware)
end

#last_requestObject

The most recent request.



32
33
34
# File 'lib/sus/fixtures/protocol/http/middleware_context.rb', line 32

def last_request
	client.last_request
end

#last_responseObject

The most recent response.



39
40
41
# File 'lib/sus/fixtures/protocol/http/middleware_context.rb', line 39

def last_response
	client.last_response
end

#middlewareObject

The middleware under test.



18
19
20
# File 'lib/sus/fixtures/protocol/http/middleware_context.rb', line 18

def middleware
	::Protocol::HTTP::Middleware::HelloWorld
end