Autofix Rubocop RSpec/ClassCheck (#23685)

This commit is contained in:
Nick Schonning 2023-02-17 21:24:16 -05:00 committed by GitHub
parent 634368c491
commit 54318dcd6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 46 deletions

View file

@ -630,20 +630,6 @@ RSpec/Capybara/FeatureMethods:
- 'spec/features/log_in_spec.rb'
- 'spec/features/profile_spec.rb'
# Offense count: 32
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: be_a, be_kind_of
RSpec/ClassCheck:
Exclude:
- 'spec/lib/settings/extend_spec.rb'
- 'spec/models/concerns/account_interactions_spec.rb'
- 'spec/models/custom_emoji_filter_spec.rb'
- 'spec/models/session_activation_spec.rb'
- 'spec/models/setting_spec.rb'
- 'spec/models/user_role_spec.rb'
- 'spec/models/user_spec.rb'
# Offense count: 558
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without

View file

@ -10,7 +10,7 @@ RSpec.describe Settings::Extend do
describe '#settings' do
it 'sets @settings as an instance of Settings::ScopedSettings' do
user = Fabricate(:user)
expect(user.settings).to be_kind_of Settings::ScopedSettings
expect(user.settings).to be_a Settings::ScopedSettings
end
end
end

View file

@ -94,7 +94,7 @@ describe AccountInteractions do
describe '#follow!' do
it 'creates and returns Follow' do
expect do
expect(account.follow!(target_account)).to be_kind_of Follow
expect(account.follow!(target_account)).to be_a Follow
end.to change { account.following.count }.by 1
end
end
@ -102,7 +102,7 @@ describe AccountInteractions do
describe '#block' do
it 'creates and returns Block' do
expect do
expect(account.block!(target_account)).to be_kind_of Block
expect(account.block!(target_account)).to be_a Block
end.to change { account.block_relationships.count }.by 1
end
end
@ -116,7 +116,7 @@ describe AccountInteractions do
it 'creates Mute, and returns Mute' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.to change { account.mute_relationships.count }.by 1
end
end
@ -126,7 +126,7 @@ describe AccountInteractions do
it 'creates Mute, and returns Mute' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.to change { account.mute_relationships.count }.by 1
end
end
@ -136,7 +136,7 @@ describe AccountInteractions do
it 'creates Mute, and returns Mute' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.to change { account.mute_relationships.count }.by 1
end
end
@ -162,7 +162,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(true)
end
end
@ -172,7 +172,7 @@ describe AccountInteractions do
it 'returns Mute, and updates mute.hide_notifications false' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.to change { mute.reload.hide_notifications? }.from(true).to(false)
end
end
@ -182,7 +182,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(true)
end
end
@ -196,7 +196,7 @@ describe AccountInteractions do
it 'returns Mute, and updates mute.hide_notifications true' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.to change { mute.reload.hide_notifications? }.from(false).to(true)
end
end
@ -206,7 +206,7 @@ describe AccountInteractions do
it 'returns Mute without updating mute.hide_notifications' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.not_to change { mute.reload.hide_notifications? }.from(false)
end
end
@ -216,7 +216,7 @@ describe AccountInteractions do
it 'returns Mute, and updates mute.hide_notifications true' do
expect do
expect(subject).to be_kind_of Mute
expect(subject).to be_a Mute
end.to change { mute.reload.hide_notifications? }.from(false).to(true)
end
end
@ -231,7 +231,7 @@ describe AccountInteractions do
it 'creates and returns ConversationMute' do
expect do
is_expected.to be_kind_of ConversationMute
is_expected.to be_a ConversationMute
end.to change { account.conversation_mutes.count }.by 1
end
end
@ -243,7 +243,7 @@ describe AccountInteractions do
it 'creates and returns AccountDomainBlock' do
expect do
is_expected.to be_kind_of AccountDomainBlock
is_expected.to be_a AccountDomainBlock
end.to change { account.domain_blocks.count }.by 1
end
end
@ -254,7 +254,7 @@ describe AccountInteractions do
context 'following target_account' do
it 'returns destroyed Follow' do
account.active_relationships.create(target_account: target_account)
is_expected.to be_kind_of Follow
is_expected.to be_a Follow
expect(subject).to be_destroyed
end
end
@ -272,7 +272,7 @@ describe AccountInteractions do
context 'blocking target_account' do
it 'returns destroyed Block' do
account.block_relationships.create(target_account: target_account)
is_expected.to be_kind_of Block
is_expected.to be_a Block
expect(subject).to be_destroyed
end
end
@ -290,7 +290,7 @@ describe AccountInteractions do
context 'muting target_account' do
it 'returns destroyed Mute' do
account.mute_relationships.create(target_account: target_account)
is_expected.to be_kind_of Mute
is_expected.to be_a Mute
expect(subject).to be_destroyed
end
end
@ -310,7 +310,7 @@ describe AccountInteractions do
context 'muting the conversation' do
it 'returns destroyed ConversationMute' do
account.conversation_mutes.create(conversation: conversation)
is_expected.to be_kind_of ConversationMute
is_expected.to be_a ConversationMute
expect(subject).to be_destroyed
end
end
@ -331,7 +331,7 @@ describe AccountInteractions do
it 'returns destroyed AccountDomainBlock' do
account_domain_block = Fabricate(:account_domain_block, domain: domain)
account.domain_blocks << account_domain_block
is_expected.to be_kind_of AccountDomainBlock
is_expected.to be_a AccountDomainBlock
expect(subject).to be_destroyed
end
end

View file

@ -15,7 +15,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { local: true } }
it 'returns ActiveRecord::Relation' do
expect(subject).to be_kind_of(ActiveRecord::Relation)
expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_2])
end
end
@ -24,7 +24,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { remote: true } }
it 'returns ActiveRecord::Relation' do
expect(subject).to be_kind_of(ActiveRecord::Relation)
expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0, custom_emoji_1])
end
end
@ -33,7 +33,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { by_domain: 'a' } }
it 'returns ActiveRecord::Relation' do
expect(subject).to be_kind_of(ActiveRecord::Relation)
expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0])
end
end
@ -42,7 +42,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { shortcode: 'hoge' } }
it 'returns ActiveRecord::Relation' do
expect(subject).to be_kind_of(ActiveRecord::Relation)
expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_2])
end
end
@ -62,7 +62,7 @@ RSpec.describe CustomEmojiFilter do
let(:params) { { hoge: nil } }
it 'returns ActiveRecord::Relation' do
expect(subject).to be_kind_of(ActiveRecord::Relation)
expect(subject).to be_a(ActiveRecord::Relation)
expect(subject).to match_array([custom_emoji_0, custom_emoji_1, custom_emoji_2])
end
end

View file

@ -7,7 +7,7 @@ RSpec.describe SessionActivation, type: :model do
let(:session_activation) { Fabricate(:session_activation, user_agent: 'Chrome/62.0.3202.89') }
it 'sets a Browser instance as detection' do
expect(session_activation.detection).to be_kind_of Browser::Chrome
expect(session_activation.detection).to be_a Browser::Chrome
end
end
@ -80,7 +80,7 @@ RSpec.describe SessionActivation, type: :model do
end
it 'returns an instance of SessionActivation' do
expect(described_class.activate(**options)).to be_kind_of SessionActivation
expect(described_class.activate(**options)).to be_a SessionActivation
end
end

View file

@ -127,7 +127,7 @@ RSpec.describe Setting, type: :model do
let(:records) { [original_setting] }
it 'returns a Hash' do
expect(described_class.all_as_records).to be_kind_of Hash
expect(described_class.all_as_records).to be_a Hash
end
context 'records includes Setting with var as the key' do
@ -146,7 +146,7 @@ RSpec.describe Setting, type: :model do
it 'includes Setting with value of default_value' do
setting = described_class.all_as_records[key]
expect(setting).to be_kind_of Setting
expect(setting).to be_a Setting
expect(setting).to have_attributes(var: key)
expect(setting).to have_attributes(value: 'default_value')
end
@ -181,7 +181,7 @@ RSpec.describe Setting, type: :model do
let(:enabled) { true }
it 'returns instance of RailsSettings::Default' do
is_expected.to be_kind_of RailsSettings::Default
is_expected.to be_a RailsSettings::Default
end
end
end

View file

@ -127,7 +127,7 @@ RSpec.describe UserRole, type: :model do
subject { described_class.everyone }
it 'returns a role' do
expect(subject).to be_kind_of(described_class)
expect(subject).to be_a(described_class)
end
it 'is identified as the everyone role' do
@ -147,7 +147,7 @@ RSpec.describe UserRole, type: :model do
subject { described_class.nobody }
it 'returns a role' do
expect(subject).to be_kind_of(described_class)
expect(subject).to be_a(described_class)
end
it 'is identified as the nobody role' do

View file

@ -313,7 +313,7 @@ RSpec.describe User, type: :model do
describe 'settings' do
it 'is instance of Settings::ScopedSettings' do
user = Fabricate(:user)
expect(user.settings).to be_kind_of Settings::ScopedSettings
expect(user.settings).to be_a Settings::ScopedSettings
end
end