aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/new_base')
-rw-r--r--actionpack/test/new_base/metal_test.rb11
-rw-r--r--actionpack/test/new_base/test_helper.rb24
2 files changed, 22 insertions, 13 deletions
diff --git a/actionpack/test/new_base/metal_test.rb b/actionpack/test/new_base/metal_test.rb
index c7c45b5cc9..2b7720863a 100644
--- a/actionpack/test/new_base/metal_test.rb
+++ b/actionpack/test/new_base/metal_test.rb
@@ -1,13 +1,12 @@
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module MetalTest
- class MetalMiddleware < ActionController::Metal
- def index
+ class MetalMiddleware < ActionController::Middleware
+ def call(env)
if env["PATH_INFO"] =~ /authed/
- self.response = app.call(env)
+ app.call(env)
else
- self.response_body = "Not authed!"
- self.status = 401
+ [401, headers, "Not authed!"]
end
end
end
@@ -21,7 +20,7 @@ module MetalTest
class TestMiddleware < ActiveSupport::TestCase
def setup
@app = Rack::Builder.new do
- use MetalMiddleware.middleware(:index)
+ use MetalMiddleware
run Endpoint.new
end.to_app
end
diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb
index 9271b2dd59..b7ccd3db8d 100644
--- a/actionpack/test/new_base/test_helper.rb
+++ b/actionpack/test/new_base/test_helper.rb
@@ -35,12 +35,6 @@ class Rack::TestCase < ActionController::IntegrationTest
setup do
ActionController::Base.session_options[:key] = "abc"
ActionController::Base.session_options[:secret] = ("*" * 30)
-
- controllers = ActionController::Base.subclasses.map do |k|
- k.underscore.sub(/_controller$/, '')
- end
-
- ActionController::Routing.use_controllers!(controllers)
end
def app
@@ -91,10 +85,26 @@ end
class ::ApplicationController < ActionController::Base
end
+module ActionController
+ class << Routing
+ def possible_controllers
+ @@possible_controllers ||= []
+ end
+ end
+
+ class Base
+ def self.inherited(klass)
+ name = klass.name.underscore.sub(/_controller$/, '')
+ ActionController::Routing.possible_controllers << name unless name.blank?
+ super
+ end
+ end
+end
+
class SimpleRouteCase < Rack::TestCase
setup do
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action/:id'
end
end
-end \ No newline at end of file
+end