Sha256: b2da193b285f798840aa341de544f8d1a660b4d879413da704edf46477ad5de0

Contents?: true

Size: 898 Bytes

Versions: 9

Compression:

Stored size: 898 Bytes

Contents

require File.dirname(__FILE__)+'/../spec_helper'
CODE_FILE = File.dirname(__FILE__)+'/../../lib/gorillib/logger/log.rb'
require CODE_FILE

describe 'Logger' do
  describe '#dump' do
    it 'inspects each arg and sends tab-separated to Log.debug' do
      Log.should_receive(:debug).with(%Q{{:hi=>"there"}\t3\t"bye"})
      Log.dump({ :hi => "there" }, 3, "bye")
    end
  end

  it 'does not create a log if one exists' do
    dummy = 'dummy'
    Object.instance_eval{ remove_const(:Log) rescue nil ; ::Log = dummy }
    load(CODE_FILE)
    ::Log.should equal(dummy)
    Object.instance_eval{ remove_const(:Log) rescue nil }
  end

  it 'creates a new log to STDERR' do
    @old_stderr = $stderr
    $stderr = StringIO.new
    Object.instance_eval{ remove_const(:Log) rescue nil }
    load(CODE_FILE)
    Log.info 'hi mom'
    $stderr.string.should =~ /hi mom/
    $stderr = @old_stderr
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gorillib-0.1.7 spec/logger/log_spec.rb
gorillib-0.1.6 spec/logger/log_spec.rb
gorillib-0.1.5 spec/logger/log_spec.rb
gorillib-0.1.4 spec/logger/log_spec.rb
gorillib-0.1.3 spec/logger/log_spec.rb
gorillib-0.1.2 spec/logger/log_spec.rb
gorillib-0.1.1 spec/logger/log_spec.rb
gorillib-0.1.0 spec/logger/log_spec.rb
gorillib-0.0.8 spec/logger/log_spec.rb