diff options
| author | Joshua Peek <josh@joshpeek.com> | 2010-01-04 19:46:21 -0600 | 
|---|---|---|
| committer | Joshua Peek <josh@joshpeek.com> | 2010-01-04 19:46:21 -0600 | 
| commit | 3f28e0bda6386ed25d07182dd39b84f6a7d330da (patch) | |
| tree | ed8c45a6cc2a179a7c4786348fd09e81f89984ce | |
| parent | 76b5f18feba3f1d0507b4c4ec34d11d9bb1c493c (diff) | |
| download | rails-3f28e0bda6386ed25d07182dd39b84f6a7d330da.tar.gz rails-3f28e0bda6386ed25d07182dd39b84f6a7d330da.tar.bz2 rails-3f28e0bda6386ed25d07182dd39b84f6a7d330da.zip  | |
Trash string coercion rack hacks
| -rw-r--r-- | actionpack/lib/action_dispatch.rb | 1 | ||||
| -rw-r--r-- | actionpack/lib/action_dispatch/middleware/string_coercion.rb | 29 | ||||
| -rw-r--r-- | actionpack/test/abstract_unit.rb | 1 | ||||
| -rw-r--r-- | actionpack/test/dispatch/string_coercion_test.rb | 40 | ||||
| -rw-r--r-- | railties/lib/rails/configuration.rb | 1 | ||||
| -rw-r--r-- | railties/test/application/middleware_test.rb | 1 | 
6 files changed, 0 insertions, 73 deletions
diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb index 1e87a016f9..ad6d54b6a2 100644 --- a/actionpack/lib/action_dispatch.rb +++ b/actionpack/lib/action_dispatch.rb @@ -47,7 +47,6 @@ module ActionDispatch      autoload :Rescue      autoload :ShowExceptions      autoload :Static -    autoload :StringCoercion    end    autoload :MiddlewareStack, 'action_dispatch/middleware/stack' diff --git a/actionpack/lib/action_dispatch/middleware/string_coercion.rb b/actionpack/lib/action_dispatch/middleware/string_coercion.rb deleted file mode 100644 index 232e947835..0000000000 --- a/actionpack/lib/action_dispatch/middleware/string_coercion.rb +++ /dev/null @@ -1,29 +0,0 @@ -module ActionDispatch -  class StringCoercion -    class UglyBody < ActiveSupport::BasicObject -      def initialize(body) -        @body = body -      end - -      def each -        @body.each do |part| -          yield part.to_s -        end -      end - -      private -        def method_missing(*args, &block) -          @body.__send__(*args, &block) -        end -    end - -    def initialize(app) -      @app = app -    end - -    def call(env) -      status, headers, body = @app.call(env) -      [status, headers, UglyBody.new(body)] -    end -  end -end diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 27461ce673..3f7a5c89b9 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -114,7 +114,6 @@ end  class ActionController::IntegrationTest < ActiveSupport::TestCase    def self.build_app(routes = nil)      ActionDispatch::MiddlewareStack.new { |middleware| -      middleware.use "ActionDispatch::StringCoercion"        middleware.use "ActionDispatch::ShowExceptions"        middleware.use "ActionDispatch::Callbacks"        middleware.use "ActionDispatch::ParamsParser" diff --git a/actionpack/test/dispatch/string_coercion_test.rb b/actionpack/test/dispatch/string_coercion_test.rb deleted file mode 100644 index d79b17b932..0000000000 --- a/actionpack/test/dispatch/string_coercion_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'abstract_unit' - -class StringCoercionTest < ActiveSupport::TestCase -  test "body responds to each" do -    original_body = [] -    body = ActionDispatch::StringCoercion::UglyBody.new(original_body) - -    assert original_body.respond_to?(:each) -    assert body.respond_to?(:each) -  end - -  test "body responds to to_path" do -    original_body = [] -    def original_body.to_path; end -    body = ActionDispatch::StringCoercion::UglyBody.new(original_body) - -    assert original_body.respond_to?(:to_path) -    assert body.respond_to?(:to_path) -  end - -  test "body does not responds to to_path" do -    original_body = [] -    body = ActionDispatch::StringCoercion::UglyBody.new(original_body) - -    assert !original_body.respond_to?(:to_path) -    assert !body.respond_to?(:to_path) -  end - -  test "calls to_s on body parts" do -    app = lambda { |env| -      [200, {'Content-Type' => 'html'}, [1, 2, 3]] -    } -    app = ActionDispatch::StringCoercion.new(app) -    parts = [] -    status, headers, body = app.call({}) -    body.each { |part| parts << part } - -    assert_equal %w( 1 2 3 ), parts -  end -end diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 7929cba2fe..e976c971f0 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -19,7 +19,6 @@ module Rails          middleware.use('ActionDispatch::ParamsParser')          middleware.use('::Rack::MethodOverride')          middleware.use('::Rack::Head') -        middleware.use('ActionDispatch::StringCoercion')        end      end diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index df564011d3..397968a4e7 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -23,7 +23,6 @@ module ApplicationTests          "ActionDispatch::ParamsParser",          "Rack::MethodOverride",          "Rack::Head", -        "ActionDispatch::StringCoercion",          "ActiveRecord::ConnectionAdapters::ConnectionManagement",          "ActiveRecord::QueryCache"        ], middleware  | 
