macmillan-utils 1.0.39 → 1.0.40

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: 342d3f41a7778b3ea802b26a9f307f7a866291ce
4
- data.tar.gz: b5f073466080b7af195b081f479146a6f7fb9c4d
3
+ metadata.gz: 035e98cbc71c2bebdd28ae144cbcd2f67d4b4271
4
+ data.tar.gz: 74d77b9604b18e7e0587c5b369197d9cb9273fc0
5
5
  SHA512:
6
- metadata.gz: 192d5d9564ec74e1f896b410745effe764e11d919410482ede6770be1d0be77d6325944fcc4aaa427cd14b2bc7451dc1d4506d620d02b55f67c4e0a82c109de4
7
- data.tar.gz: cb28995106f7da3fd9d4e18d7ac02bd2f61f53489c56f4adbfd87e3154d6bfb6a23eee0957480547cd8c87fcd06d7c696df9b872483334d99c85d9b8cf4236c8
6
+ metadata.gz: c2787195fab5f2524f0d886f488580ea2f0b791d0f01e9f96fe2d4429d793d89be50003e97200c86c2a694c21553aef4b2498698e3d47ce16239fa0e4fb313ec
7
+ data.tar.gz: b06b8e063a31ca8044e10fc8e9ab12b15e53011da44b4307dca0388185f93eb12adb8d6ebdae17200fa6569de7f5f642ff520189166d7686ceb4eafbea95bc0b
@@ -35,7 +35,7 @@ module Macmillan
35
35
  def msg2str(msg)
36
36
  case msg
37
37
  when ::String
38
- msg
38
+ "#{msg}\n"
39
39
  when ::Exception
40
40
  "#{msg.message} (#{msg.class})\n" << (msg.backtrace || []).join("\n")
41
41
  else
@@ -1,3 +1,5 @@
1
+ require 'securerandom'
2
+
1
3
  module Macmillan
2
4
  module Utils
3
5
  module Middleware
@@ -17,22 +17,27 @@ describe Macmillan::Utils::Logger::Formatter do
17
17
  it 'is called by the logger object' do
18
18
  expect(target).to receive(:write).once
19
19
  expect(subject).to receive(:call).once
20
- logger.info 'this is a test'
20
+ logger.info('this is a test')
21
21
  end
22
22
 
23
23
  context 'when a prefix is set' do
24
- let(:prefix) { 'WEEEE' }
24
+ let(:prefix) { 'WEEEE' }
25
+ let(:level_prefix) { '[ INFO]:' }
26
+ let(:suffix) { "\n" }
25
27
 
26
- it 'is put in front of the log message' do
27
- expect(target).to receive(:write).with("#{prefix} [ INFO]: #{msg}").once
28
- logger.info msg
28
+ it 'appears in front of the log message, and the expected suffix applies' do
29
+ expect(target).to receive(:write).with("#{prefix} #{level_prefix} #{msg}#{suffix}").once
30
+ logger.info(msg)
29
31
  end
30
32
  end
31
33
 
32
34
  context 'when the log message is a string' do
33
- it 'returns the string' do
34
- expect(target).to receive(:write).with("[ INFO]: #{msg}").once
35
- logger.info msg
35
+ let(:level_prefix) { '[ INFO]:' }
36
+ let(:suffix) { "\n" }
37
+
38
+ it 'returns the string prefixed and suffixed appropriately' do
39
+ expect(target).to receive(:write).with("#{level_prefix} #{msg}#{suffix}").once
40
+ logger.info(msg)
36
41
  end
37
42
  end
38
43
 
@@ -41,7 +46,7 @@ describe Macmillan::Utils::Logger::Formatter do
41
46
  ex = StandardError.new('qwerty')
42
47
  allow(ex).to receive(:backtrace).and_return(%w(foo bar baz quux))
43
48
  expect(target).to receive(:write).with("[ INFO]: qwerty (StandardError)\nfoo\nbar\nbaz\nquux").once
44
- logger.info ex
49
+ logger.info(ex)
45
50
  end
46
51
  end
47
52
 
@@ -49,8 +54,7 @@ describe Macmillan::Utils::Logger::Formatter do
49
54
  it 'retuns object.inspect' do
50
55
  ex = []
51
56
  expect(ex).to receive(:inspect).once
52
-
53
- logger.info ex
57
+ logger.info(ex)
54
58
  end
55
59
  end
56
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macmillan-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.39
4
+ version: 1.0.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Springer Nature
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-20 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler