Sha256: 5698933f148598e2510ab88e6ad6904657c613faec13f23365fb6e2e917697b4

Contents?: true

Size: 739 Bytes

Versions: 10

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe UniformNotifier::CustomizedLogger do
  it 'should not notify to customized logger' do
    expect(UniformNotifier::CustomizedLogger.out_of_channel_notify(title: 'notify rails logger')).to be_nil
  end

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

    now = Time.now
    allow(Time).to receive(:now).and_return(now)
    UniformNotifier.customized_logger = logger
    UniformNotifier::CustomizedLogger.out_of_channel_notify(title: 'notify rails logger')

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
uniform_notifier-1.16.0 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.15.0 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.14.2 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.14.1 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.14.0 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.13.2 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.13.1 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.13.0 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.12.1 spec/uniform_notifier/customized_logger_spec.rb
uniform_notifier-1.12.0 spec/uniform_notifier/customized_logger_spec.rb