Skip to content

Commit

Permalink
Lint Style/RedundantBegin
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle committed Aug 16, 2021
1 parent 64b5d96 commit 1fcfef4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
6 changes: 0 additions & 6 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
12 changes: 5 additions & 7 deletions spec/faraday/request/instrumentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ def instrument(name, env)

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
Expand Down
10 changes: 4 additions & 6 deletions spec/faraday/response/json_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ def process(body, content_type = 'application/json', options = {})
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
Expand Down

0 comments on commit 1fcfef4

Please sign in to comment.