Sha256: ce8bdf710bb83061ee0ca7149efa840ff974f012c1b9caaf5787e0f3813d5eb8

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

describe Fume::SmartLogger do
  before(:each) do
    @logger = Logger.new(STDOUT)
  end
  
  it "should be create STDOUT logger" do
    Logger.should_receive(:new).with(STDOUT).and_return(@logger)
    result = SmartLogger.create("STDOUT")
    result.should be_eql @logger
    result.level.should be_eql Logger::DEBUG
  end
  
  it "should be create log file logger" do
    Logger.should_receive(:new).with(Rails.root.join("log", "file.log")).and_return(@logger)
    result = SmartLogger.create("file", Logger::INFO)
    result.should be_eql @logger
    result.level.should be_eql Logger::INFO
  end
  
  it "should be create log file logger with ext" do
    Logger.should_receive(:new).with(Rails.root.join("log", "file.log")).and_return(@logger)
    SmartLogger.create("file.log").should be_eql @logger
  end
  
  it "should be create log file by Rails env" do
    Logger.should_receive(:new).with(Rails.root.join("log", "development.log")).and_return(@logger)
    Rails.env = "development"
    SmartLogger.create(nil).should be_eql @logger
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fume-0.5.3 spec/fume/smart_logger_spec.rb
fume-0.5.2 spec/fume/smart_logger_spec.rb
fume-0.5.1 spec/fume/smart_logger_spec.rb
fume-0.5.0 spec/fume/smart_logger_spec.rb
fume-0.4.3 spec/fume/smart_logger_spec.rb
fume-0.4.2 spec/fume/smart_logger_spec.rb
fume-0.4.1 spec/fume/smart_logger_spec.rb
fume-0.4.0 spec/fume/smart_logger_spec.rb
fume-0.3.5 spec/fume/smart_logger_spec.rb