slack-ruby-bot 0.8.1 → 0.8.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: f872fa7b4cc7c405bc25e0802e243826672c098f
4
- data.tar.gz: ed6a6038cf90aea81894759e73b2991a484f0d09
3
+ metadata.gz: d1348b71125e07ba882c91f785c185b39fd6f169
4
+ data.tar.gz: be83b12cf72deed88f2b7a85bf4cb68dcb6bf6fa
5
5
  SHA512:
6
- metadata.gz: 2823b93a71bd803ebdbd3d753785e457250275dc2a0bb9eee72a4b7e9986f9060fa42487676d7ca6ed32513173c5ee51cc33274f69fc6c1e43d5c7311fce1386
7
- data.tar.gz: 6d08cab72ee6db777d275550654154d9186b35643107529ee25c59e449fb19b52f6a7dde58bcef583dba4c19fb201bfe140cfe832daff91f07321e6cec0483c2
6
+ metadata.gz: ce40f511fb328ea0574b6189ad8dcef5de8401ac79a7c1bee9fb0c06d1bfcf0ccb6744e9fe71c29b302973ac8af713628229cf1a85aea41ae2ec910b185b37da
7
+ data.tar.gz: 89df71def40ed033436c1703cd15ac08e6f2999f4187c4996101ae022651a6c52a8e60e78466ce4551b357e6f5b53fe95e50b08d650be73677fd744ade9125ce
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ### 0.8.1 (6/10/2016)
1
+ ### 0.8.2 (7/10/2016)
2
+
3
+ * [#85](https://github.com/dblock/slack-ruby-bot/issues/85): Fix: regression in bot instance logging - [@dblock](https://github.com/dblock).
4
+
5
+ ### 0.8.1 (7/10/2016)
2
6
 
3
7
  * [#69](https://github.com/dblock/slack-ruby-bot/pull/69): Ability to add help info to bot and commands - [@accessd](https://github.com/accessd).
4
8
  * [#75](https://github.com/dblock/slack-ruby-bot/issues/75): Guarantee order of command evaluation - [@dblock](https://github.com/dblock).
data/README.md CHANGED
@@ -19,7 +19,7 @@ If you are not familiar with Slack bots or Slack API concepts, you might want to
19
19
 
20
20
  ## Stable Release
21
21
 
22
- You're reading the documentation for the **stable** release of slack-ruby-bot, 0.8.1. See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING.md) for how to upgrade to more recent versions.
22
+ You're reading the documentation for the **stable** release of slack-ruby-bot. See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING.md) for how to upgrade to more recent versions.
23
23
 
24
24
  ## Usage
25
25
 
@@ -1,21 +1,23 @@
1
1
  module SlackRubyBot
2
2
  module Loggable
3
3
  def self.included(base)
4
- base.send :include, LoggingMethods
5
- base.extend(LoggingMethods)
4
+ base.send :include, InstanceMethods
5
+ base.extend(ClassMethods)
6
6
  end
7
7
 
8
- def self.logger
9
- @logger ||= begin
10
- $stdout.sync = true
11
- Logger.new(STDOUT)
12
- end
8
+ module ClassMethods
9
+ def logger
10
+ @logger ||= begin
11
+ $stdout.sync = true
12
+ Logger.new(STDOUT)
13
+ end
14
+ end
13
15
  end
14
- end
15
16
 
16
- module LoggingMethods
17
- def logger
18
- Loggable.logger
17
+ module InstanceMethods
18
+ def logger
19
+ self.class.logger
20
+ end
19
21
  end
20
22
  end
21
23
  end
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBot
2
- VERSION = '0.8.1'.freeze
2
+ VERSION = '0.8.2'.freeze
3
3
  end
@@ -8,15 +8,28 @@ describe SlackRubyBot::Loggable do
8
8
  end
9
9
  end
10
10
  end
11
+ let! :child_class_with_logger do
12
+ Class.new(class_with_logger) do
13
+ def public_logger
14
+ logger
15
+ end
16
+ end
17
+ end
11
18
  describe 'logger for class' do
12
19
  it do
13
20
  expect(class_with_logger.logger).to be_kind_of Logger
21
+ expect(child_class_with_logger.logger).to be_kind_of Logger
14
22
  end
15
23
  it 'should be cached' do
16
24
  first_logger = class_with_logger.logger
17
25
  second_logger = class_with_logger.logger
18
26
  expect(first_logger.object_id).to eq second_logger.object_id
19
27
  end
28
+ it 'should not be shared by a child class' do
29
+ first_logger = class_with_logger.logger
30
+ second_logger = child_class_with_logger.logger
31
+ expect(first_logger.object_id).to_not eq second_logger.object_id
32
+ end
20
33
  end
21
34
  describe 'logger for instance' do
22
35
  it do
@@ -27,5 +40,10 @@ describe SlackRubyBot::Loggable do
27
40
  second_logger = class_with_logger.new.public_logger
28
41
  expect(first_logger.object_id).to eq second_logger.object_id
29
42
  end
43
+ it 'should not be shared by a child class' do
44
+ first_logger = class_with_logger.new.public_logger
45
+ second_logger = child_class_with_logger.new.public_logger
46
+ expect(first_logger.object_id).to_not eq second_logger.object_id
47
+ end
30
48
  end
31
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine