Sha256: 52a1032be45a4ca4ecb5747139aa42b9d07a121414af1d7a0d35f0d7841f87a8

Contents?: true

Size: 669 Bytes

Versions: 6

Compression:

Stored size: 669 Bytes

Contents

require "spec_helper"

describe UniformNotifier::CustomizedLogger do
  it "should not notify to customized logger" do
    UniformNotifier::CustomizedLogger.out_of_channel_notify("notify rails logger").should be_nil
  end

  it "should notify to customized logger" do
    logger = File.open( 'test.log', 'a+' )
    logger.sync = true

    now = Time.now
    Time.stub!(:now).and_return(now)
    UniformNotifier.customized_logger = logger
    UniformNotifier::CustomizedLogger.out_of_channel_notify("notify rails logger")

    logger.seek(0)
    logger.read.should == "#{now.strftime("%Y-%m-%d %H:%M:%S")}[WARN] notify rails logger"

    File.delete('test.log')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
uniform_notifier-1.2.0 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.1.1 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.1.0 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.0.2 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.0.1 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.0.0 spec/uniform_notifier/customized_logger_spec.rb