spec/interceptors/retry/main_spec.rb in lhc-10.5.0 vs spec/interceptors/retry/main_spec.rb in lhc-10.5.1

- old
+ new

@@ -5,18 +5,20 @@ describe LHC::Rollbar do before(:each) do LHC.config.interceptors = [LHC::Retry] end + let(:status) { 500 } + let(:request_stub) do @retry_count = 0 stub_request(:get, 'http://local.ch').to_return do |_| if @retry_count == max_retry_count { status: 200 } else @retry_count += 1 - { status: 500 } + { status: status } end end end let(:max_retry_count) { 3 } @@ -54,8 +56,18 @@ request_stub response = LHC.get('http://local.ch') expect(response.success?).to eq true expect(response.code).to eq 200 expect(request_stub).to have_been_requested.times(3) + end + end + + context 'ignore error' do + let(:status) { 404 } + + it 'does not retry if the error is explicitly ignored' do + request_stub + LHC.get('http://local.ch', retry: { max: 1 }, ignored_errors: [LHC::NotFound]) + expect(request_stub).to have_been_requested.times(1) end end end