Fix Lint/AmbiguousBlockAssociation cop (#25921)

This commit is contained in:
Matt Jankowski 2023-07-12 04:02:41 -04:00 committed by GitHub
parent b786911c55
commit 658742b3cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 15 deletions

View file

@ -48,15 +48,6 @@ Layout/SpaceInLambdaLiteral:
- 'config/environments/production.rb'
- 'config/initializers/content_security_policy.rb'
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedMethods, AllowedPatterns.
Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb'
- 'spec/controllers/settings/two_factor_authentication/otp_authentication_controller_spec.rb'
- 'spec/services/activitypub/process_status_update_service_spec.rb'
- 'spec/services/post_status_service_spec.rb'
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:

View file

@ -104,7 +104,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do
post :create,
params: { form_two_factor_confirmation: { otp_attempt: '123456' } },
session: { challenge_passed_at: Time.now.utc, new_otp_secret: 'thisisasecretforthespecofnewview' }
end.to not_change { user.reload.otp_secret }
end.to(not_change { user.reload.otp_secret })
end
it 'renders the new view' do

View file

@ -63,7 +63,7 @@ describe Settings::TwoFactorAuthentication::OtpAuthenticationController do
expect do
post :create, session: { challenge_passed_at: Time.now.utc }
end.to not_change { user.reload.otp_secret }
.and change { session[:new_otp_secret] }
.and(change { session[:new_otp_secret] })
expect(response).to redirect_to(new_settings_two_factor_authentication_confirmation_path)
end
@ -80,7 +80,7 @@ describe Settings::TwoFactorAuthentication::OtpAuthenticationController do
expect do
post :create, session: { challenge_passed_at: Time.now.utc }
end.to not_change { user.reload.otp_secret }
.and change { session[:new_otp_secret] }
.and(change { session[:new_otp_secret] })
expect(response).to redirect_to(new_settings_two_factor_authentication_confirmation_path)
end

View file

@ -214,11 +214,11 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do
end
it 'does not create any edits' do
expect { subject.call(status, json) }.to_not change { status.reload.edits.pluck(&:id) }
expect { subject.call(status, json) }.to_not(change { status.reload.edits.pluck(&:id) })
end
it 'does not update the text, spoiler_text or edited_at' do
expect { subject.call(status, json) }.to_not change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] }
expect { subject.call(status, json) }.to_not(change { s = status.reload; [s.text, s.spoiler_text, s.edited_at] })
end
end

View file

@ -52,7 +52,7 @@ RSpec.describe PostStatusService, type: :service do
end
it 'does not change statuses count' do
expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.to_not change { [account.statuses_count, previous_status.replies_count] }
expect { subject.call(account, text: 'Hi future!', scheduled_at: future, thread: previous_status) }.to_not(change { [account.statuses_count, previous_status.replies_count] })
end
end