diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-07 16:17:22 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-08-07 16:17:22 -0700 |
commit | 1f80f3a3738a57be6e36901ef60645fabb6576a9 (patch) | |
tree | 514fcce434e1309aed4fda332c889fea0803d5d7 /actionpack | |
parent | 81cfdf2489fe436bb70e0e44c5683c57d0247850 (diff) | |
download | rails-1f80f3a3738a57be6e36901ef60645fabb6576a9.tar.gz rails-1f80f3a3738a57be6e36901ef60645fabb6576a9.tar.bz2 rails-1f80f3a3738a57be6e36901ef60645fabb6576a9.zip |
remove vestigial code
Looks like this was left over from converting Rails to Rack. I think
it's safe to remove now.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/middleware.rb | 39 | ||||
-rw-r--r-- | actionpack/test/controller/new_base/metal_test.rb | 43 |
2 files changed, 0 insertions, 82 deletions
diff --git a/actionpack/lib/action_controller/middleware.rb b/actionpack/lib/action_controller/middleware.rb deleted file mode 100644 index 437fec3dc6..0000000000 --- a/actionpack/lib/action_controller/middleware.rb +++ /dev/null @@ -1,39 +0,0 @@ -module ActionController - class Middleware < Metal - class ActionMiddleware - def initialize(controller, app) - @controller, @app = controller, app - end - - def call(env) - request = ActionDispatch::Request.new(env) - @controller.build(@app).dispatch(:index, request) - end - end - - class << self - alias build new - - def new(app) - ActionMiddleware.new(self, app) - end - end - - attr_internal :app - - def process(action) - response = super - self.status, self.headers, self.response_body = response if response.is_a?(Array) - response - end - - def initialize(app) - super() - @_app = app - end - - def index - call(env) - end - end -end
\ No newline at end of file diff --git a/actionpack/test/controller/new_base/metal_test.rb b/actionpack/test/controller/new_base/metal_test.rb deleted file mode 100644 index 537b93387a..0000000000 --- a/actionpack/test/controller/new_base/metal_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'abstract_unit' - -module MetalTest - class MetalMiddleware < ActionController::Middleware - def call(env) - if env["PATH_INFO"] =~ /authed/ - app.call(env) - else - [401, headers, "Not authed!"] - end - end - end - - class Endpoint - def call(env) - [200, {}, "Hello World"] - end - end - - class TestMiddleware < ActiveSupport::TestCase - def setup - @app = Rack::Builder.new do - use MetalTest::MetalMiddleware - run MetalTest::Endpoint.new - end.to_app - end - - test "it can call the next app by using @app" do - env = Rack::MockRequest.env_for("/authed") - response = @app.call(env) - - assert_equal ["Hello World"], response[2] - end - - test "it can return a response using the normal AC::Metal techniques" do - env = Rack::MockRequest.env_for("/") - response = @app.call(env) - - assert_equal ["Not authed!"], response[2] - assert_equal 401, response[0] - end - end -end |