diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-11-02 20:09:28 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-11-02 20:09:28 -0700 |
commit | aaf1279e3e73e301b8f65b651933ebe287b82b4d (patch) | |
tree | af080b511188bb86869a107831b350deafc2b71a /test/test_clogger.rb | |
parent | 4bcd56a4f02b8a167d28505182cc6ff723fb027c (diff) | |
download | clogger-aaf1279e3e73e301b8f65b651933ebe287b82b4d.tar.gz |
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.
Diffstat (limited to 'test/test_clogger.rb')
-rw-r--r-- | test/test_clogger.rb | 17 |
1 files changed, 17 insertions, 0 deletions
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 |