diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-25 19:43:06 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-25 19:43:06 -0800 |
commit | e4ab2cc40bdbd1698f4bcf138e83c4823d118f81 (patch) | |
tree | ed48282dc431920b3163164f0224381c624ee69a /test | |
parent | fcf99bd7e3323ea99c5bfc8a3a15fbbc18cc8285 (diff) | |
download | raindrops-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.rb | 17 |
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 |