Method: Merb::Test::RequestHelper#dispatch_request

Defined in:
lib/merb-core/test/helpers/mock_request_helper.rb

#dispatch_request(request, controller_klass, action) {|controller| ... } ⇒ Object

Deprecated.

The workhorse for the dispatch*to helpers.

Parameters

request<Merb::Test::RequestHelper::FakeRequest, Merb::Request>

A request object that has been setup for testing.

controller_klass<Merb::Controller>

The class object off the controller to dispatch the action to.

action<Symbol>

The action to dispatch the request to.

&blk

The controller is yielded to the block provided for actions prior to the action being dispatched.

Returns

An instance of controller_klass based on the parameters.

Notes

Does not use routes.

:api: public

Yields:

  • (controller)


369
370
371
372
373
374
375
376
377
378
# File 'lib/merb-core/test/helpers/mock_request_helper.rb', line 369

def dispatch_request(request, controller_klass, action, &blk)
  controller = controller_klass.new(request)
  yield controller if block_given?
  controller._dispatch(action)

  Merb.logger.info controller._benchmarks.inspect
  Merb.logger.flush

  controller
end