From 51c7ac142d31095d4c699f44cc44ddea627da1eb Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 25 Aug 2015 18:35:44 -0700 Subject: provide a request and response to all controllers Controllers should always have a request and response when responding. Since we make this The Rule(tm), then controllers don't need to be somewhere in limbo between "asking a response object for a rack response" or "I, myself contain a rack response". This duality leads to conditionals spread through the codebase that we can delete: * https://github.com/rails/rails/blob/85a78d9358aa728298cd020cdc842b55c16f9549/actionpack/lib/action_controller/metal.rb#L221-L223 --- actionpack/test/abstract_unit.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'actionpack/test/abstract_unit.rb') diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 39ae8cf899..1954324222 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -121,12 +121,16 @@ class ActionDispatch::IntegrationTest < ActiveSupport::TestCase class DeadEndRoutes < ActionDispatch::Routing::RouteSet # Stub Rails dispatcher so it does not get controller references and # simply return the controller#action as Rack::Body. - class NullController + class NullController < ::ActionController::Metal def initialize(controller_name) @controller = controller_name end - def dispatch(action, req) + def make_response!(request) + self.class.make_response! request + end + + def dispatch(action, req, res) [200, {'Content-Type' => 'text/html'}, ["#{@controller}##{action}"]] end end -- cgit v1.2.3