Sha256: f943eb91b7830b20ef4aadbdf262505800523171ccf1ebc7e5380daa09c25660

Contents?: true

Size: 611 Bytes

Versions: 2

Compression:

Stored size: 611 Bytes

Contents

require 'test_helper'
require 'logger'

class LoggerProxyTest < Test::Unit::TestCase

  def test_logger_capture
    logger = Logger.new("/dev/null")
    proxy = Dreamcatcher::LoggerProxy.capture(logger) do
      logger.info "hello world"
    end
    logger.info "goodbye world"

    assert_equal proxy.log_entries.size, 1
    assert_equal proxy.log_entries.first.message, "hello world"
  end

  def test_capture_without_logger
    logger = Logger.new("/dev/null")
    proxy = Dreamcatcher::LoggerProxy.capture(nil) do
      logger.info "hello world"
    end
    assert_equal proxy.log_entries.size, 0
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dreamcatcher-0.0.2 test/logger_proxy_test.rb
dreamcatcher-0.0.1 test/logger_proxy_test.rb