Sha256: 42771e7d46633855e508937de56492ff57c4f1a230ef25fa1c4f16c7f641255a

Contents?: true

Size: 1.64 KB

Versions: 12

Compression:

Stored size: 1.64 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe 'RubyRabbitmqJanus::Log', type: :tools, name: :log do
  it 'Log instance is correctly loading' do
    expect(RubyRabbitmqJanus::Tools::Log.instance).not_to be(nil)
  end

  it 'Default level log is INFO' do
    # 0 = debug
    # ...
    # 5 = unknown
    expect(RubyRabbitmqJanus::Tools::Log.instance.level).to eq(0)
  end

  let(:message) { '## test ##' }
  let(:last_line) { IO.readlines('log/ruby-rabbitmq-janus.log')[-1..-1][0] }

  context 'when write a message unknown' do
    before { RubyRabbitmqJanus::Tools::Log.instance.unknown(message) }

    it { expect(last_line).to include('A, [RubyRabbitmqJanus] ## test ##') }
  end

  context 'when write a message fatal' do
    before { RubyRabbitmqJanus::Tools::Log.instance.fatal(message) }

    it { expect(last_line).to include('F, [RubyRabbitmqJanus] ## test ##') }
  end

  context 'when write a message error' do
    before { RubyRabbitmqJanus::Tools::Log.instance.error(message) }

    it { expect(last_line).to include('E, [RubyRabbitmqJanus] ## test ##') }
  end

  context 'when write a message warn' do
    before { RubyRabbitmqJanus::Tools::Log.instance.warn(message) }

    it { expect(last_line).to include('W, [RubyRabbitmqJanus] ## test ##') }
  end

  context 'when write a message info' do
    before { RubyRabbitmqJanus::Tools::Log.instance.info(message) }

    it { expect(last_line).to include('I, [RubyRabbitmqJanus] ## test ##') }
  end

  context 'when write a message debug' do
    before { RubyRabbitmqJanus::Tools::Log.instance.debug(message) }

    it { expect(last_line).to include('D, [RubyRabbitmqJanus] ## test ##') }
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-2.2.0.pre.42 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.1 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.1.pre.139 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0.pre.137 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0.pre.136 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0.pre.135 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0.pre.132 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0.pre.131 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0.pre.130 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0.pre.129 spec/rrj/tools/gem/rrj_log_spec.rb
ruby_rabbitmq_janus-2.1.0.pre.128 spec/rrj/tools/gem/rrj_log_spec.rb