Sha256: ea9b8934e36bf5b01073776512452a97f41356c97f5db28a0899c7fb7134a3a4

Contents?: true

Size: 598 Bytes

Versions: 4

Compression:

Stored size: 598 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

include Madvertise::Logging

describe MultiLogger do

  before(:each) do
    @logger = ImprovedLogger.new
    @logger.level = :debug
    @ml = MultiLogger.new(@logger)
  end

  it "should support attach/detach of loggers" do
    buflog = ImprovedLogger.new(:buffer)
    @ml.attach(buflog)

    STDERR.should_receive(:write).with(/test1/)
    @ml.info("test1")
    buflog.buffer.should match(/test1/)

    @ml.detach(buflog)

    STDERR.should_receive(:write).with(/test2/)
    @ml.info("test2")
    buflog.buffer.should_not match(/test2/)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
madvertise-logging-0.2.2 spec/multi_logger_spec.rb
madvertise-logging-0.2.1 spec/multi_logger_spec.rb
madvertise-logging-0.2.0 spec/multi_logger_spec.rb
madvertise-logging-0.1.0 spec/multi_logger_spec.rb