Sha256: 7c636b0169e5c466a4212df26159037fdff5a1f35a826001485983ba33343a1c

Contents?: true

Size: 905 Bytes

Versions: 35

Compression:

Stored size: 905 Bytes

Contents

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

class TestLogging
  include Logging
end

describe Logging do
  before do
    Logging.silent = false
    @object = TestLogging.new
  end
  
  it "should output debug when set to true" do
    Logging.debug = true
    @object.should_receive(:puts)
    @object.debug 'hi'
  end

  it "should output trace when set to true" do
    Logging.trace = true
    @object.should_receive(:puts)
    @object.trace 'hi'
  end

  it "should not output when silenced" do
    Logging.silent = true
    @object.should_not_receive(:puts)
    @object.log 'hi'
  end
  
  it "should not output when silenced as instance method" do
    @object.silent = true
    
    @object.should_not_receive(:puts)
    @object.log 'hi'
  end
  
  it "should be usable as module functions" do
    Logging.silent = true
    Logging.log "hi"
  end
  
  after do
    Logging.silent = true
  end
end

Version data entries

35 entries across 35 versions & 6 rubygems

Version Path
grockit-thin-0.8.2 spec/logging_spec.rb
macournoyer-thin-1.0.1 spec/logging_spec.rb
macournoyer-thin-1.1.0 spec/logging_spec.rb
michaelyta-thin-1.2.2 spec/logging_spec.rb
thin-1.2.11 spec/logging_spec.rb
thin-1.2.11-x86-mswin32 spec/logging_spec.rb
thin-1.2.11-x86-mingw32 spec/logging_spec.rb
thin-1.2.10 spec/logging_spec.rb
thin-1.2.10-x86-mswin32 spec/logging_spec.rb
thin-1.2.10-x86-mingw32 spec/logging_spec.rb
thin-1.2.9 spec/logging_spec.rb
thin-1.2.9-x86-mswin32 spec/logging_spec.rb
thin-1.2.9-x86-mingw32 spec/logging_spec.rb
thin-1.2.8 spec/logging_spec.rb
thin-1.2.8-x86-mswin32 spec/logging_spec.rb
thin-1.2.8-x86-mingw32 spec/logging_spec.rb
steamcannon-thin-1.2.8 spec/logging_spec.rb
thin-1.2.7 spec/logging_spec.rb
thin-1.2.7-x86-mswin32 spec/logging_spec.rb
thin-1.2.7-x86-mingw32 spec/logging_spec.rb