Sha256: e22d698f2fd0c730d3b38d59750a3475e84c6f16b14cb3d948e1cf0b8ef66c2e

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

require 'rspec'
$:.unshift File.expand_path('../../', __FILE__)
require 'active_mocker/logger'

describe ActiveMocker::Logger do

  describe '::set' do

    let(:logger){double()}

    around do
      described_class.class_variable_set(:@@logger, nil)
    end

    it 'set the logger to be used by the mock class' do
      described_class.set(logger)
      expect(described_class.class_variable_get(:@@logger)).to eq(logger)
    end

    it 'will pass any methods to the set logger' do
      described_class.set(logger)
      expect(logger).to receive(:info)
      described_class.info
    end

    it 'will return nil if no logger is set' do
      expect(described_class.any_method).to eq nil
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_mocker-1.4.2 spec/lib/active_mocker/logger_spec.rb
active_mocker-1.4.1 spec/lib/active_mocker/logger_spec.rb