summary refs log tree commit
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-05-10 22:19:20 -0500
committerJoshua Peek <josh@joshpeek.com>2009-05-10 22:19:20 -0500
commit0bf8d8e840ae226d6efed8af345feb67a10f6aa6 (patch)
treea1887b21485b17235382cc486dddd0d4fb5288b2
parent815342a8e15db564b766f209ffb1e340233f064f (diff)
downloadrack-0bf8d8e840ae226d6efed8af345feb67a10f6aa6.tar.gz
Kill request instance memoization
-rw-r--r--lib/rack/request.rb8
-rw-r--r--test/spec_rack_mock.rb2
-rw-r--r--test/spec_rack_request.rb16
3 files changed, 1 insertions, 25 deletions
diff --git a/lib/rack/request.rb b/lib/rack/request.rb
index 0bff7af0..be534a85 100644
--- a/lib/rack/request.rb
+++ b/lib/rack/request.rb
@@ -17,14 +17,6 @@ module Rack
     # The environment of the request.
     attr_reader :env
 
-    def self.new(env, *args)
-      if self == Rack::Request
-        env["rack.request"] ||= super
-      else
-        super
-      end
-    end
-
     def initialize(env)
       @env = env
     end
diff --git a/test/spec_rack_mock.rb b/test/spec_rack_mock.rb
index bf09c2e0..a03bedc2 100644
--- a/test/spec_rack_mock.rb
+++ b/test/spec_rack_mock.rb
@@ -216,7 +216,7 @@ context "Rack::MockResponse" do
     res.original_headers["Content-Type"].should.equal "text/yaml"
     res["Content-Type"].should.equal "text/yaml"
     res.content_type.should.equal "text/yaml"
-    res.content_length.should.be 477  # needs change often.
+    res.content_length.should.be 414  # needs change often.
     res.location.should.be.nil
   end
 
diff --git a/test/spec_rack_request.rb b/test/spec_rack_request.rb
index dbfd5b17..7e4be775 100644
--- a/test/spec_rack_request.rb
+++ b/test/spec_rack_request.rb
@@ -467,22 +467,6 @@ EOF
     res.body.should.equal '212.212.212.212'
   end
 
-  specify "memoizes itself to reduce the cost of repetitive initialization" do
-    env = Rack::MockRequest.env_for("http://example.com:8080/")
-    env['rack.request'].should.be.nil
-
-    req1 = Rack::Request.new(env)
-    env['rack.request'].should.not.be.nil
-    req1.should.equal env['rack.request']
-
-    rack_request_object_id = env['rack.request'].object_id
-
-    req2 = Rack::Request.new(env)
-    env['rack.request'].should.not.be.nil
-    rack_request_object_id.should.be.equal env['rack.request'].object_id
-    req2.should.equal env['rack.request']
-  end
-
   class MyRequest < Rack::Request
     def params
       {:foo => "bar"}