Sha256: c2d0be2e840a9a832de5a1887d5e167ad37b725fbb951c464717da1767d90ea5

Contents?: true

Size: 1006 Bytes

Versions: 116

Compression:

Stored size: 1006 Bytes

Contents

require 'rails_helper'

TYPES = %i[error warn info debug].freeze

describe PgEngine::PgLogger do
  before do
    TYPES.each do |type|
      allow(Rails.logger).to receive(type)
      allow(Rollbar).to receive(type)
    end
  end

  shared_examples 'logger' do |type|
    it do
      expect(Rails.logger).to have_received(type).once
    end

    it do
      expect(Rollbar).to have_received(type).once
    end
  end

  describe '#pg_log' do
    TYPES.each do |type|
      context "con type #{type}" do
        before { pg_log(type, 'bla') }

        it_behaves_like 'logger', type
      end
    end
  end

  describe '#pg_err' do
    before { pg_err('bla') }

    it_behaves_like 'logger', :error
  end

  describe '#pg_debug' do
    before { pg_debug('bla') }

    it_behaves_like 'logger', :debug
  end

  describe '#pg_warn' do
    before { pg_warn('bla') }

    it_behaves_like 'logger', :warn
  end

  describe '#pg_info' do
    before { pg_info('bla') }

    it_behaves_like 'logger', :info
  end
end

Version data entries

116 entries across 116 versions & 1 rubygems

Version Path
pg_rails-7.6.21.pre.4 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.21.pre.3 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.21.pre.2 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.21.pre.1 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.20 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.19 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.18 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.17 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.16 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.15 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.14 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.13 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.12 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.11 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.10 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.9 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.8 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.7 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.6 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.6.5 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb