logger-better 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0188f0b4f63a728e7f73321d82ac79b7b8ec92bd
4
- data.tar.gz: 2d8c8508931a8471d954ebdcc18a1e25157ba7aa
3
+ metadata.gz: 1240ecdb63276440b7a88815f3f82ba3414232c6
4
+ data.tar.gz: 6a0c6492f60e882660e605cddf7e7eff486c130f
5
5
  SHA512:
6
- metadata.gz: 6308239bb7237ed4fa8eb38dd89e9e5da1754ebe691ea43804e1ecf82616b4042cdd2f26b2c81eb6004c65164ca65bf4df2ea8cab4af51bfe33430c561a02461
7
- data.tar.gz: eaca5033654f00f6bdb513d65dc64a5b7f51298c92a7dc916437dbc86a09650a086ac0acda326ffeebf56a469a060f3b5840f6fd6452d24176ff0b571372b521
6
+ metadata.gz: b30925e9f820ec578df34c89bf5e56291d99b859de7bdd36496fccc11540dbedc063a5c8fe544572999d8acfa78def9f8b628b3e1d2ce79cb9560d361ce61d54
7
+ data.tar.gz: 9c233ad88d62897b839b865db2382499097e45fbe368ac1379376bed390a8d49503a0b37b8cb66d126dfd2f9d4072b23194a711686189205b8a5bf215bb340b6
@@ -1,5 +1,5 @@
1
1
  class Logger
2
2
  module Better
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@ class NullLogger < Logger
7
7
 
8
8
  # All other methods (debug/info) etc use add internally.
9
9
  # It's the lowest level public interface.
10
- def add(*args, &block)
11
-
10
+ def add(severity, message = nil, progname = nil)
11
+ yield if message.nil?
12
12
  end
13
13
  end
@@ -6,4 +6,24 @@ class NullLoggerTest < MiniTest::Unit::TestCase
6
6
  logger = NullLogger.new
7
7
  logger.add Logger::INFO, 'hi', 'tests'
8
8
  end
9
+
10
+ def test_yields_when_block_given
11
+ logger = NullLogger.new
12
+
13
+ yielded = false
14
+
15
+ logger.debug('foo') { yielded = true ; 'message' }
16
+
17
+ assert yielded, 'Block not yielded'
18
+ end
19
+
20
+ def test_does_not_yield_when_message_set
21
+ logger = NullLogger.new
22
+
23
+ yielded = false
24
+
25
+ logger.add(Logger::INFO, 'message') { yielded = true ; 'message' }
26
+
27
+ refute yielded, 'Block yielded'
28
+ end
9
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logger-better
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ahawkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-13 00:00:00.000000000 Z
11
+ date: 2015-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler