Sha256: cbb0e108e001099cd1ad6cf85e0e0caf4068dc48dbe6c251942a8d5907bb7e6c
Contents?: true
Size: 2 KB
Versions: 3
Compression:
Stored size: 2 KB
Contents
require 'rails_helper' TYPES = %i[error warn info debug].freeze describe PgEngine::PgLogger do describe '#pg_err' 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).twice end it do expect(Rollbar).to have_received(type).once end end context 'con string' do before { pg_err('bla') } it_behaves_like 'logger', :error end context 'con exception' do before do raise StandardError, 'bla' rescue StandardError => e pg_err(e) end it_behaves_like 'logger', :error end end describe '#pg_warn' 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).twice end it do expect(Rollbar).to have_received(type).once end end TYPES.each do |type| context "con type #{type}" do before { pg_warn('bla', type) } it_behaves_like 'logger', type end end context 'con exception' do before do raise StandardError, 'bla' rescue StandardError => e pg_warn(e) end it_behaves_like 'logger', :error end end describe '#pg_log' 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).twice end it do expect(Rollbar).to have_received(type).once end end TYPES.each do |type| context "con type #{type}" do before { pg_log('bla', type) } it_behaves_like 'logger', type end end end end
Version data entries
3 entries across 3 versions & 1 rubygems