summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-08-03 12:25:45 -0500
committerJoshua Peek <josh@joshpeek.com>2009-08-03 12:25:45 -0500
commit9a1e52b240be1e8cb62989739fba4d7e46681a1d (patch)
tree26c7831e9afe8d1f79acbc8e0dba211d7352510d
parent663b8ec47eff66f75abd037736213232823838f6 (diff)
downloadrack-9a1e52b240be1e8cb62989739fba4d7e46681a1d.tar.gz
Kill request instance memoization
Conflicts: test/spec_rack_mock.rb
-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 b16306b1..9c392a28 100644
--- a/test/spec_rack_mock.rb
+++ b/test/spec_rack_mock.rb
@@ -130,7 +130,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 464 # needs change often.
+ res.content_length.should.be 401 # 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"}