spec/thesis/controllers/thesis_controller_spec.rb
# Mock a request to the controller without
# Using Rails routing. Makes the response available
# in the @response instance variable.
Mock a request to the controller without
Using Rails routing. Makes the response available
in the @response instance variable.
Mock a request to the controller without Using Rails routing . Makes the response available in the @response instance variable .
def make_request(action, params = {})
  path = params[:path] || "/"
  method = params[:method] || "post"
  env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)
  status, headers, body = described_class.action(action).call(env)
  @response = ActionDispatch::TestResponse.new(status, headers, body)
  @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']
end
def make_request ( action , params = { } ) path = params [ :path ] || "/" method = params [ :method ] || "post" env = Rack :: MockRequest . env_for ( path , params : params . except ( :path ) . except ( :method ) , method : method ) status , headers , body = described_class . action ( action ) . call ( env ) @response = ActionDispatch :: TestResponse . new ( status , headers , body ) @controller = body . instance_variable_get ( :@response ) . request . env [ 'action_controller.instance' ] end
Mock a request to the controller without
Using Rails routing.
Mock a request to the controller without Using Rails routing .
action
<not_specific>
params
<not_specific>