diff options
Diffstat (limited to 'test/test_clogger.rb')
-rw-r--r-- | test/test_clogger.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 8e6604e..d3e315e 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -434,4 +434,23 @@ class TestClogger < Test::Unit::TestCase assert_equal "text/plain\n", str.string end + def test_clogger_synced + io = StringIO.new + logger = Struct.new(:sync, :io).new(false, io) + assert ! logger.sync + def logger.<<(str) + io << str + end + app = lambda { |env| [302, [ %w(a) ], []] } + cl = Clogger.new(app, :logger => logger) + assert logger.sync + end + + def test_clogger_unsyncable + logger = '' + assert ! logger.respond_to?('sync=') + app = lambda { |env| [302, [ %w(a) ], []] } + assert_nothing_raised { Clogger.new(app, :logger => logger) } + end + end |