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.0.8.pre.alpha.101 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.100 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.99 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.98 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.97 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.96 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.95 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.94 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.93 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.92 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.91 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.90 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.89 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.88 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.87 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb
pg_rails-7.0.8.pre.alpha.86 pg_engine/spec/lib/pg_engine/utils/pg_engine/pg_logger_spec.rb