diff options
Diffstat (limited to 'test/spec_lock.rb')
-rw-r--r-- | test/spec_lock.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/spec_lock.rb b/test/spec_lock.rb index aa3efa54..c6f7c05e 100644 --- a/test/spec_lock.rb +++ b/test/spec_lock.rb @@ -147,7 +147,8 @@ describe Rack::Lock do }, false) env = Rack::MockRequest.env_for("/") env['rack.multithread'].must_equal true - app.call(env) + _, _, body = app.call(env) + body.close env['rack.multithread'].must_equal true end @@ -191,4 +192,13 @@ describe Rack::Lock do lambda { app.call(env) }.must_raise Exception lock.synchronized.must_equal false end + + it "not replace the environment" do + env = Rack::MockRequest.env_for("/") + app = lock_app(lambda { |inner_env| [200, {"Content-Type" => "text/plain"}, [inner_env.object_id.to_s]] }) + + _, _, body = app.call(env) + + body.to_enum.to_a.must_equal [env.object_id.to_s] + end end |