Autofix Rubocop RSpec/BeNil (#23653)
This commit is contained in:
parent
936204b9ea
commit
68b1071f86
|
@ -914,25 +914,6 @@ RSpec/BeEq:
|
|||
- 'spec/workers/feed_insert_worker_spec.rb'
|
||||
- 'spec/workers/regeneration_worker_spec.rb'
|
||||
|
||||
# Offense count: 22
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: be, be_nil
|
||||
RSpec/BeNil:
|
||||
Exclude:
|
||||
- 'spec/controllers/accounts_controller_spec.rb'
|
||||
- 'spec/controllers/activitypub/collections_controller_spec.rb'
|
||||
- 'spec/controllers/activitypub/outboxes_controller_spec.rb'
|
||||
- 'spec/controllers/activitypub/replies_controller_spec.rb'
|
||||
- 'spec/controllers/api/v1/apps_controller_spec.rb'
|
||||
- 'spec/controllers/api/v1/statuses_controller_spec.rb'
|
||||
- 'spec/controllers/instance_actors_controller_spec.rb'
|
||||
- 'spec/controllers/statuses_controller_spec.rb'
|
||||
- 'spec/models/account_statuses_cleanup_policy_spec.rb'
|
||||
- 'spec/models/concerns/account_interactions_spec.rb'
|
||||
- 'spec/models/session_activation_spec.rb'
|
||||
- 'spec/models/user_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
RSpec/BeforeAfterAll:
|
||||
Exclude:
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe AccountsController, type: :controller do
|
|||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe ActivityPub::CollectionsController, type: :controller do
|
|||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
|
|
@ -6,7 +6,7 @@ RSpec.describe ActivityPub::OutboxesController, type: :controller do
|
|||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
|
|
@ -11,7 +11,7 @@ RSpec.describe ActivityPub::RepliesController, type: :controller do
|
|||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
|
|
@ -28,7 +28,7 @@ RSpec.describe Api::V1::AppsController, type: :controller do
|
|||
end
|
||||
|
||||
it 'creates an OAuth app' do
|
||||
expect(Doorkeeper::Application.find_by(name: client_name)).to_not be nil
|
||||
expect(Doorkeeper::Application.find_by(name: client_name)).to_not be_nil
|
||||
end
|
||||
|
||||
it 'returns client ID and client secret' do
|
||||
|
|
|
@ -195,7 +195,7 @@ RSpec.describe Api::V1::StatusesController, type: :controller do
|
|||
end
|
||||
|
||||
it 'removes the status' do
|
||||
expect(Status.find_by(id: status.id)).to be nil
|
||||
expect(Status.find_by(id: status.id)).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ RSpec.describe InstanceActorsController, type: :controller do
|
|||
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
|
|
@ -8,7 +8,7 @@ describe StatusesController do
|
|||
shared_examples 'cacheable response' do
|
||||
it 'does not set cookies' do
|
||||
expect(response.cookies).to be_empty
|
||||
expect(response.headers['Set-Cookies']).to be nil
|
||||
expect(response.headers['Set-Cookies']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not set sessions' do
|
||||
|
|
|
@ -35,61 +35,61 @@ RSpec.describe AccountStatusesCleanupPolicy, type: :model do
|
|||
it 'invalidates last_inspected when widened because of keep_direct' do
|
||||
account_statuses_cleanup_policy.keep_direct = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_pinned' do
|
||||
account_statuses_cleanup_policy.keep_pinned = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_polls' do
|
||||
account_statuses_cleanup_policy.keep_polls = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_media' do
|
||||
account_statuses_cleanup_policy.keep_media = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_self_fav' do
|
||||
account_statuses_cleanup_policy.keep_self_fav = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of keep_self_bookmark' do
|
||||
account_statuses_cleanup_policy.keep_self_bookmark = false
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of higher min_favs' do
|
||||
account_statuses_cleanup_policy.min_favs = 5
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of disabled min_favs' do
|
||||
account_statuses_cleanup_policy.min_favs = nil
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of higher min_reblogs' do
|
||||
account_statuses_cleanup_policy.min_reblogs = 5
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
|
||||
it 'invalidates last_inspected when widened because of disable min_reblogs' do
|
||||
account_statuses_cleanup_policy.min_reblogs = nil
|
||||
account_statuses_cleanup_policy.save
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be nil
|
||||
expect(account_statuses_cleanup_policy.last_inspected).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ describe AccountInteractions do
|
|||
|
||||
context 'not muting the conversation' do
|
||||
it 'returns nil' do
|
||||
is_expected.to be nil
|
||||
is_expected.to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,7 +44,7 @@ RSpec.describe SessionActivation, type: :model do
|
|||
let(:id) { nil }
|
||||
|
||||
it 'returns nil' do
|
||||
is_expected.to be nil
|
||||
is_expected.to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -89,7 +89,7 @@ RSpec.describe SessionActivation, type: :model do
|
|||
let(:id) { nil }
|
||||
|
||||
it 'returns nil' do
|
||||
expect(described_class.deactivate(id)).to be nil
|
||||
expect(described_class.deactivate(id)).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ RSpec.describe User, type: :model do
|
|||
it 'saves nil for otp_secret' do
|
||||
user = Fabricate.build(:user, otp_secret: 'oldotpcode')
|
||||
user.disable_two_factor!
|
||||
expect(user.reload.otp_secret).to be nil
|
||||
expect(user.reload.otp_secret).to be_nil
|
||||
end
|
||||
|
||||
it 'saves cleared otp_backup_codes' do
|
||||
|
|
Loading…
Reference in New Issue