diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-08-26 00:18:52 -0700 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-08-26 00:18:52 -0700 |
commit | 9408fcd2e858ae48dd30d9e8d1bb1dcbbfffb840 (patch) | |
tree | c16d280b988d662041fc5834d07078d9da6f2b37 /actionpack/test/new_base | |
parent | 78129b1731a1e6f3b091e996bcf55917d84b5f0e (diff) | |
download | rails-9408fcd2e858ae48dd30d9e8d1bb1dcbbfffb840.tar.gz rails-9408fcd2e858ae48dd30d9e8d1bb1dcbbfffb840.tar.bz2 rails-9408fcd2e858ae48dd30d9e8d1bb1dcbbfffb840.zip |
Create new ActionController::Middleware class that will work as a normal Rack middleware.
* This initial implementation is a bit hackish, but it uses a normal middleware API
so it's future-proof when we improve the internals.
Diffstat (limited to 'actionpack/test/new_base')
-rw-r--r-- | actionpack/test/new_base/metal_test.rb | 11 |
1 files changed, 5 insertions, 6 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 |