fizx-loggable 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/loggable.rb +2 -1
- data/test/test_loggable.rb +8 -0
- metadata +1 -1
data/lib/loggable.rb
CHANGED
@@ -26,7 +26,7 @@ require "logger"
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def l
|
29
|
-
self.class.logger
|
29
|
+
respond_to?(:logger) ? logger : self.class.logger
|
30
30
|
end
|
31
31
|
|
32
32
|
def fatal(*a, &b)
|
@@ -51,6 +51,7 @@ require "logger"
|
|
51
51
|
|
52
52
|
def self.included(klass)
|
53
53
|
klass.extend(ClassMethods)
|
54
|
+
klass.extend(self)
|
54
55
|
end
|
55
56
|
|
56
57
|
extend(LoggableMethods)
|
data/test/test_loggable.rb
CHANGED
@@ -6,6 +6,10 @@ require File.dirname(__FILE__) + "/../lib/loggable"
|
|
6
6
|
class TestLoggable < Test::Unit::TestCase
|
7
7
|
include Loggable
|
8
8
|
|
9
|
+
def setup
|
10
|
+
TestLoggable.logger = nil
|
11
|
+
end
|
12
|
+
|
9
13
|
def test_calls
|
10
14
|
l = mock()
|
11
15
|
l.expects(:fatal).with("fatal").times(2)
|
@@ -43,4 +47,8 @@ class TestLoggable < Test::Unit::TestCase
|
|
43
47
|
assert_equal "debug", Loggable.default.level
|
44
48
|
|
45
49
|
end
|
50
|
+
|
51
|
+
def test_class_methods
|
52
|
+
TestLoggable.info "hi"
|
53
|
+
end
|
46
54
|
end
|