test/test_clogger.rb in clogger-0.0.6 vs test/test_clogger.rb in clogger-0.0.7
- old
+ new
@@ -467,6 +467,26 @@
cl = Clogger.new(app, :logger => s, :format => "<$request", :ORS => ">")
cl.call(@req)
assert_equal "<GET /hello?goodbye=true HTTP/1.0>", s
end
+ def test_clogger_body_not_closeable
+ s = ''
+ app = lambda { |env| [302, [ %w(a) ], []] }
+ cl = Clogger.new(app, :logger => s)
+ status, headers, body = cl.call(@req)
+ assert_nil body.close
+ end
+
+ def test_clogger_body_close_return_value
+ s = ''
+ body = []
+ def body.close
+ :foo
+ end
+ app = lambda { |env| [302, [ %w(a) ], body ] }
+ cl = Clogger.new(app, :logger => s)
+ status, headers, body = cl.call(@req)
+ assert_equal :foo, body.close
+ end
+
end