Sha256: 58babe717886f4d36d5647bfa41535b408fe39f8600a6d132c1532490cfa8dcd
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require 'rails_helper' describe LHC::Rollbar do before(:each) do LHC.config.interceptors = [LHC::Rollbar] end it 'does not report if Rollbar is not defined' do stub_request(:get, 'http://local.ch').to_return(status: 400) expect(-> { LHC.get('http://local.ch') }) .to raise_error LHC::BadRequest end context 'Rollbar is defined' do before(:each) do class Rollbar; end allow(::Rollbar).to receive(:error) end it 'does report errors to rollbar' do stub_request(:get, 'http://local.ch').to_return(status: 400) expect(-> { LHC.get('http://local.ch') }) .to raise_error LHC::BadRequest expect(::Rollbar).to have_received(:error) .with(LHC::BadRequest, hash_including(response: anything, request: anything)) end context 'additional params' do it 'does report errors to rollbar with additional data' do stub_request(:get, 'http://local.ch') .to_return(status: 400) expect(-> { LHC.get('http://local.ch', rollbar: { additional: 'data' }) }) .to raise_error LHC::BadRequest expect(::Rollbar).to have_received(:error) .with( LHC::BadRequest, hash_including( response: anything, request: anything, additional: 'data' ) ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lhc-core-interceptors-2.3.1 | spec/rollbar/main_spec.rb |
lhc-core-interceptors-2.3.0 | spec/rollbar/main_spec.rb |