Lint Style/RedundantBegin

This commit is contained in:
Olle Jonsson 2021-08-16 14:46:26 +02:00 committed by Olle Jonsson
parent 59c32867b3
commit e640be9866
3 changed files with 9 additions and 19 deletions

View File

@ -67,9 +67,3 @@ Performance/StringInclude:
Exclude:
- 'spec/support/fake_safe_buffer.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/RedundantBegin:
Exclude:
- 'spec/faraday/request/instrumentation_spec.rb'
- 'spec/faraday/response/json_spec.rb'

View File

@ -30,13 +30,11 @@ RSpec.describe Faraday::Request::Instrumentation do
it { expect(options.name).to eq('request.faraday') }
it 'defaults to ActiveSupport::Notifications' do
begin
res = options.instrumenter
rescue NameError => e
expect(e.to_s).to match('ActiveSupport')
else
expect(res).to eq(ActiveSupport::Notifications)
end
res = options.instrumenter
rescue NameError => e
expect(e.to_s).to match('ActiveSupport')
else
expect(res).to eq(ActiveSupport::Notifications)
end
it 'instruments with default name' do

View File

@ -76,12 +76,10 @@ RSpec.describe Faraday::Response::Json, type: :response do
end
it 'includes the response on the ParsingError instance' do
begin
process('{') { |env| env[:response] = Faraday::Response.new }
raise 'Parsing should have failed.'
rescue Faraday::ParsingError => e
expect(e.response).to be_a(Faraday::Response)
end
process('{') { |env| env[:response] = Faraday::Response.new }
raise 'Parsing should have failed.'
rescue Faraday::ParsingError => e
expect(e.response).to be_a(Faraday::Response)
end
context 'HEAD responses' do