1 require File.dirname(__FILE__) + '/helper'
3 class TestLogger < Test::Unit::TestCase
11 @log.expects(:info).with("qux")
14 @log.log(stub(:name => 'foo'), :info, "qux")
17 assert_equal 1, @log.logs.size
18 assert_instance_of Time, @log.logs['foo'][0][0]
19 assert_match(/qux/, @log.logs['foo'][0][1])
22 def test_log_should_send_to_syslog
23 Syslog.expects(:crit).with('foo')
26 @log.log(stub(:name => 'foo'), :fatal, "foo")
32 def test_watch_log_since
36 @log.log(stub(:name => 'foo'), :info, "one")
37 @log.log(stub(:name => 'foo'), :info, "two")
40 assert_match(/one.*two/m, @log.watch_log_since('foo', t1))
45 @log.log(stub(:name => 'foo'), :info, "three")
48 out = @log.watch_log_since('foo', t2)
50 assert_no_match(/one/, out)
51 assert_no_match(/two/, out)
52 assert_match(/three/, out)
61 assert_equal 0, @log.logs.size