Sha256: 8517ca175dac1704db6906300e0c73865dfc95f0b602cb6e49e858a8717618f8

Contents?: true

Size: 865 Bytes

Versions: 5

Compression:

Stored size: 865 Bytes

Contents

require 'spec_helper'

describe SlackRubyBot::Loggable do
  let! :class_with_logger do
    Class.new(SlackRubyBot::Commands::Base) do
      def public_logger
        logger
      end
    end
  end
  describe 'logger for class' do
    it do
      expect(class_with_logger.logger).to be_kind_of Logger
    end
    it 'should be cached' do
      first_logger = class_with_logger.logger
      second_logger = class_with_logger.logger
      expect(first_logger.object_id).to eq second_logger.object_id
    end
  end
  describe 'logger for instance' do
    it do
      expect(class_with_logger.new.public_logger).to be_kind_of Logger
    end
    it 'should be cached' do
      first_logger = class_with_logger.new.public_logger
      second_logger = class_with_logger.new.public_logger
      expect(first_logger.object_id).to eq second_logger.object_id
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slack-ruby-bot-0.8.1 spec/slack-ruby-bot/support/loggable_spec.rb
slack-ruby-bot-0.8.0 spec/slack-ruby-bot/support/loggable_spec.rb
slack-ruby-bot-0.7.0 spec/slack-ruby-bot/support/loggable_spec.rb
slack-ruby-bot-0.6.2 spec/slack-ruby-bot/support/loggable_spec.rb
slack-ruby-bot-0.6.1 spec/slack-ruby-bot/support/loggable_spec.rb