slack_log_device 2.0.0 → 2.0.1

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: 3567b60b8adf372370ebeff154732ea9c0c85a6b
4
- data.tar.gz: 1eaa0fea7a5ce04b969ef5ee2c5fd806e558d822
3
+ metadata.gz: 32885688b1cd9ac6a722a1a6f33555c509eb165f
4
+ data.tar.gz: 74ccc8aaa57329d2290dee6601fd6d82f9e31663
5
5
  SHA512:
6
- metadata.gz: 721424872c5fbb4f9a997ef2c10b2c35f917255062fe469db09d7cf417295396ff955c23bfa1b7bcd827c5881a060c6e0c8bc157a633a8f8f9a66df9db88d08f
7
- data.tar.gz: bd94f833858783c0ea6c4b649ea1a9cb7610302cf36e49cf9e42f2ebf4d0783d1c567061b70c0b282cc7ea8a6f5e51d8041d6ac0bc241a0406c3af3fc600bb9b
6
+ metadata.gz: 5fbf9de73db847487a88e5dd455865c4d892ad47fa2bd95c687655165c7da7701970d4a785931c1eb7c32ce1733c10963e3654940aefc3ff1590ee266a08c882
7
+ data.tar.gz: 2345e2526588ca41890abbd5e9864311b2ac19fd58c108608766eda3f2547629cba76846ef1d20f2d0a06f55db689d4c1afcc00b62fe51aea96ce1405742c6d0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
@@ -88,14 +88,10 @@ class SlackLogDevice
88
88
  @mutex.synchronize do
89
89
  @buffer << message
90
90
  end
91
- if flush?
91
+ @flush_thread.kill if @flush_thread
92
+ @flush_thread = Thread.new do
93
+ sleep(flush_delay) unless auto_flush?
92
94
  flush
93
- else
94
- @flush_thread.kill if @flush_thread
95
- @flush_thread = Thread.new do
96
- sleep(flush_delay)
97
- flush
98
- end
99
95
  end
100
96
  nil
101
97
  end
@@ -356,6 +356,7 @@ describe SlackLogDevice do
356
356
  it 'does nothing if log level is lower than specified one' do
357
357
  expect(HTTParty).not_to receive(:post)
358
358
  logger.debug('BIM!')
359
+ device.flush
359
360
  end
360
361
 
361
362
  it 'strips message' do
@@ -363,9 +364,16 @@ describe SlackLogDevice do
363
364
  expect(device.instance_variable_get(:@buffer)).to eq(['BAM !'])
364
365
  end
365
366
 
367
+ it 'converts message to string' do
368
+ device.write(42)
369
+ expect(device.instance_variable_get(:@buffer)).to eq(['42'])
370
+ end
371
+
366
372
  it 'does nothing if message is blank' do
367
373
  expect(HTTParty).not_to receive(:post)
368
- expect(device.write(" \n")).to be_nil
374
+ expect {
375
+ expect(device.write(" \n")).to be_nil
376
+ }.not_to change { device.instance_variable_get(:@buffer) }
369
377
  end
370
378
 
371
379
  it 'does nothing if message is nil' do
@@ -386,12 +394,6 @@ describe SlackLogDevice do
386
394
  device.flush
387
395
  end
388
396
 
389
- it 'flush if auto flush is true' do
390
- options[:auto_flush] = true
391
- expect(HTTParty).to receive(:post)
392
- device.write('BAM!')
393
- end
394
-
395
397
  it 'does not post HTTP message if auto flush is false' do
396
398
  expect(HTTParty).not_to receive(:post)
397
399
  device.write('BAM!')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_log_device
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte