diff options
Diffstat (limited to 'actionpack/test/abstract_unit.rb')
-rw-r--r-- | actionpack/test/abstract_unit.rb | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 367eb90831..c5b2493e06 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -122,27 +122,19 @@ class ActionDispatch::IntegrationTest < ActiveSupport::TestCase # Stub Rails dispatcher so it does not get controller references and # simply return the controller#action as Rack::Body. class NullController < ::ActionController::Metal - def initialize(controller_name) - @controller = controller_name - end - - def make_response!(request) - self.class.make_response! request - end - - def dispatch(action, req, res) - [200, {"Content-Type" => "text/html"}, ["#{@controller}##{action}"]] + def self.dispatch(action, req, res) + [200, { "Content-Type" => "text/html" }, ["#{req.params[:controller]}##{action}"]] end end - class NullControllerRequest < DelegateClass(ActionDispatch::Request) + class NullControllerRequest < ActionDispatch::Request def controller_class - NullController.new params[:controller] + NullController end end def make_request(env) - NullControllerRequest.new super + NullControllerRequest.new env end end @@ -159,7 +151,7 @@ class ActionDispatch::IntegrationTest < ActiveSupport::TestCase yield temporary_routes ensure self.class.app = old_app - self.remove! + remove! silence_warnings { Object.const_set(:SharedTestRoutes, old_routes) } end @@ -172,7 +164,7 @@ class ActionDispatch::IntegrationTest < ActiveSupport::TestCase ActiveSupport::Dependencies.autoload_paths << path yield ensure - ActiveSupport::Dependencies.autoload_paths.reject! {|p| p == path} + ActiveSupport::Dependencies.autoload_paths.reject! { |p| p == path } ActiveSupport::Dependencies.clear end end @@ -247,7 +239,6 @@ module ActionController end end - class ::ApplicationController < ActionController::Base end @@ -268,9 +259,9 @@ module ActionDispatch host = uri_or_host.host unless path path ||= uri_or_host.path - params = {"PATH_INFO" => path, + params = { "PATH_INFO" => path, "REQUEST_METHOD" => method, - "HTTP_HOST" => host} + "HTTP_HOST" => host } routes.call(params) end |