Sha256: b3536f5784eec84dddf1f2a83c2970c9ff901897030a8e99f8bc1b3cedac2591

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe Heirloom do

  it "should create a new logger object from the hash passed as :logger" do
    logger_mock = mock 'logger'
    logger_mock.should_receive(:info).with 'a message'
    logger_mock.should_receive(:level=).with Logger::INFO
    logger = Heirloom::HeirloomLogger.new :logger => logger_mock
    logger.info 'a message'
  end

  it "should create a new logger object when one is not passed" do
    logger_mock = mock 'logger'
    Logger.should_receive(:new).with(STDOUT).and_return logger_mock
    logger_mock.should_receive(:info).with 'a message'
    logger_mock.should_receive(:level=).with Logger::INFO
    logger = Heirloom::HeirloomLogger.new
    logger.info 'a message'
  end

  it "should set the log level to debug when passed in as log_level" do
    logger_mock = mock 'logger'
    Logger.should_receive(:new).with(STDOUT).and_return logger_mock
    logger_mock.should_receive(:level=).with Logger::DEBUG
    logger = Heirloom::HeirloomLogger.new :log_level => 'debug'
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heirloom-0.2.0 spec/logger_spec.rb