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.
File without changes
@@ -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
@@ -5,7 +5,7 @@ require 'tempfile'
5
5
 
6
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
8
- require 'log_block'
8
+ require 'log-block'
9
9
 
10
10
  class Test::Unit::TestCase
11
11
  def last_line( file )
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.2.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/log_block.rb
28
+ - lib/log-block.rb
29
29
  - test/test_helper.rb
30
30
  - test/log_block_test.rb
31
31
  - LICENSE