From aaf1279e3e73e301b8f65b651933ebe287b82b4d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 2 Nov 2012 20:09:28 -0700 Subject: avoid calling "<<" on env["rack.errors"] Rack::Lint::ErrorWrapper forbids the "<<" method. This fallback only comes into play when no log destination (via :logger or :path) is specified and is rarely an issue in real setups. --- test/test_clogger.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/test_clogger.rb') diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 10c587a..9bff918 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -837,4 +837,21 @@ class TestClogger < Test::Unit::TestCase expect = "\"GET http://example.com/hello?goodbye=true HTTP/1.0\"\n" assert_equal [ expect ], s end + + def test_lint_error_wrapper + require 'rack/lobster' + @req["SERVER_NAME"] = "FOO" + @req["SERVER_PORT"] = "666" + @req["rack.version"] = [1,1] + @req["rack.multithread"] = true + @req["rack.multiprocess"] = true + @req["rack.run_once"] = false + app = Rack::ContentLength.new(Rack::ContentType.new(Rack::Lobster.new)) + cl = Clogger.new(app, format: :Combined) + @req["rack.errors"] = err = StringIO.new + status, headers, body = r = Rack::Lint.new(cl).call(@req) + body.each { |x| assert_kind_of String, x.to_str } + body.close # might raise here + assert_match(%r{GET /hello}, err.string) + end end -- cgit v1.2.3-24-ge0c7