Autofix Rubocop Lint/AmbiguousOperator (#23680)

lolsob-rspec
Nick Schonning 2023-02-17 21:22:01 -05:00 committed by GitHub
parent 8fa4163574
commit efcf9f0076
4 changed files with 7 additions and 15 deletions

View File

@ -183,14 +183,6 @@ Lint/AmbiguousBlockAssociation:
- 'spec/services/unsuspend_account_service_spec.rb'
- 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_spec.rb'
# Offense count: 7
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperator:
Exclude:
- 'spec/controllers/api/v1/suggestions_controller_spec.rb'
- 'spec/lib/request_spec.rb'
- 'spec/models/user_role_spec.rb'
# Offense count: 17
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperatorPrecedence:

View File

@ -29,7 +29,7 @@ RSpec.describe Api::V1::SuggestionsController, type: :controller do
json = body_as_json
expect(json.size).to be >= 1
expect(json.map { |i| i[:id] }).to include *[bob, jeff].map { |i| i.id.to_s }
expect(json.map { |i| i[:id] }).to include(*[bob, jeff].map { |i| i.id.to_s })
end
end
end

View File

@ -43,7 +43,7 @@ describe Request do
before { stub_request(:get, 'http://example.com') }
it 'executes a HTTP request' do
expect { |block| subject.perform &block }.to yield_control
expect { |block| subject.perform(&block) }.to yield_control
expect(a_request(:get, 'http://example.com')).to have_been_made.once
end
@ -54,18 +54,18 @@ describe Request do
allow(resolver).to receive(:timeouts=).and_return(nil)
allow(Resolv::DNS).to receive(:open).and_yield(resolver)
expect { |block| subject.perform &block }.to yield_control
expect { |block| subject.perform(&block) }.to yield_control
expect(a_request(:get, 'http://example.com')).to have_been_made.once
end
it 'sets headers' do
expect { |block| subject.perform &block }.to yield_control
expect { |block| subject.perform(&block) }.to yield_control
expect(a_request(:get, 'http://example.com').with(headers: subject.headers)).to have_been_made
end
it 'closes underlying connection' do
expect_any_instance_of(HTTP::Client).to receive(:close)
expect { |block| subject.perform &block }.to yield_control
expect { |block| subject.perform(&block) }.to yield_control
end
it 'returns response which implements body_with_limit' do

View File

@ -139,7 +139,7 @@ RSpec.describe UserRole, type: :model do
end
it 'has negative position' do
expect(subject.position).to eq -1
expect(subject.position).to eq(-1)
end
end
@ -159,7 +159,7 @@ RSpec.describe UserRole, type: :model do
end
it 'has negative position' do
expect(subject.position).to eq -1
expect(subject.position).to eq(-1)
end
end