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,14 +30,12 @@ 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
end
it 'instruments with default name' do
expect(instrumenter.instrumentations.size).to eq(0)

View File

@ -76,13 +76,11 @@ 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
end
context 'HEAD responses' do
it "nullifies the body if it's only one space" do