log-block 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/{log_block.rb → log-block.rb} +0 -0
- data/test/log_block_test.rb +36 -0
- data/test/test_helper.rb +1 -1
- metadata +2 -2
File without changes
|
data/test/log_block_test.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'activesupport'
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
class LogBlockTest < Test::Unit::TestCase
|
@@ -31,5 +33,39 @@ class LogBlockTest < Test::Unit::TestCase
|
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
36
|
+
context "using a BufferedLogger" do
|
37
|
+
setup do
|
38
|
+
@output = Tempfile.new("logblocktest")
|
39
|
+
@logger = ActiveSupport::BufferedLogger.new( @output )
|
40
|
+
# @logger.datetime_format = "%Y-%m-%d"
|
41
|
+
end
|
42
|
+
|
43
|
+
should "respond to :with" do
|
44
|
+
assert @logger.respond_to?(:with)
|
45
|
+
end
|
46
|
+
|
47
|
+
should "return a block logger for with" do
|
48
|
+
@logger.with("Block") do |block_logger|
|
49
|
+
block_logger.debug("In Block")
|
50
|
+
assert_last_line @output, " Block:In Block"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
should "not indent" do
|
55
|
+
@logger.debug("Testing")
|
56
|
+
assert_last_line @output, "Testing"
|
57
|
+
end
|
58
|
+
|
59
|
+
context "with one level" do
|
60
|
+
setup do
|
61
|
+
@block_logger = @logger.get_block_logger "Block:"
|
62
|
+
end
|
63
|
+
|
64
|
+
should "indent by one level" do
|
65
|
+
@block_logger.debug("123Testing")
|
66
|
+
assert_last_line @output, " Block:123Testing"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
34
70
|
|
35
71
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log-block
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Moses
|
@@ -25,7 +25,7 @@ extra_rdoc_files:
|
|
25
25
|
files:
|
26
26
|
- VERSION.yml
|
27
27
|
- README.rdoc
|
28
|
-
- lib/
|
28
|
+
- lib/log-block.rb
|
29
29
|
- test/test_helper.rb
|
30
30
|
- test/log_block_test.rb
|
31
31
|
- LICENSE
|