gearheads
/
mastodon
Archived
2
0
Fork 0

Autofix Rubocop Lint/AmbiguousOperator (#23680)

gh/dev
Nick Schonning 2023-02-17 21:22:01 -05:00 committed by GitHub
parent ac59d6f19f
commit 6d42820e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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/services/unsuspend_account_service_spec.rb'
- 'spec/workers/scheduler/accounts_statuses_cleanup_scheduler_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 # Offense count: 17
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperatorPrecedence: Lint/AmbiguousOperatorPrecedence:

View File

@ -29,7 +29,7 @@ RSpec.describe Api::V1::SuggestionsController, type: :controller do
json = body_as_json json = body_as_json
expect(json.size).to be >= 1 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 end
end end

View File

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

View File

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