about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-02-25 19:43:06 -0800
committerEric Wong <normalperson@yhbt.net>2011-02-25 19:43:06 -0800
commite4ab2cc40bdbd1698f4bcf138e83c4823d118f81 (patch)
treeed48282dc431920b3163164f0224381c624ee69a /test
parentfcf99bd7e3323ea99c5bfc8a3a15fbbc18cc8285 (diff)
downloadraindrops-e4ab2cc40bdbd1698f4bcf138e83c4823d118f81.tar.gz
We need to do this for apps that depend on things like the
sendfile() optimizations in Rainbows!
Diffstat (limited to 'test')
-rw-r--r--test/test_middleware.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/test_middleware.rb b/test/test_middleware.rb
index e2fdc38..eedf04a 100644
--- a/test/test_middleware.rb
+++ b/test/test_middleware.rb
@@ -14,7 +14,7 @@ class TestMiddleware < Test::Unit::TestCase
     app = Raindrops::Middleware.new(@app)
     response = app.call({})
     assert_equal @response[0,2], response[0,2]
-    assert response.last.kind_of?(Raindrops::Middleware)
+    assert response.last.kind_of?(Raindrops::Middleware::Proxy)
     assert response.last.object_id != app.object_id
     tmp = []
     response.last.each { |y| tmp << y }
@@ -35,7 +35,7 @@ class TestMiddleware < Test::Unit::TestCase
     assert_equal 0, stats.calling
     assert_equal 1, stats.writing
     assert_equal 200, response[0]
-    assert response.last.kind_of?(Raindrops::Middleware)
+    assert response.last.kind_of?(Raindrops::Middleware::Proxy)
     tmp = []
     response.last.each do |y|
       assert_equal 1, stats.writing
@@ -108,4 +108,17 @@ class TestMiddleware < Test::Unit::TestCase
     assert_equal expect, response
   end
 
+  def test_middleware_proxy_to_path_missing
+    app = Raindrops::Middleware.new(@app)
+    response = app.call({})
+    body = response[2]
+    assert_kind_of Raindrops::Middleware::Proxy, body
+    assert ! body.respond_to?(:to_path)
+    assert body.respond_to?(:close)
+    orig_body = @response[2]
+
+    def orig_body.to_path; "/dev/null"; end
+    assert body.respond_to?(:to_path)
+    assert_equal "/dev/null", body.to_path
+  end
 end