0
0
Fork 0

Autofix Rubocop RSpec/ImplicitSubject (#23721)

This commit is contained in:
Nick Schonning 2023-02-19 23:00:48 -05:00 committed by GitHub
parent 63e6353886
commit 38a1d8bb85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 184 additions and 221 deletions

View file

@ -14,13 +14,13 @@ describe AccountInteractions do
context 'account with Follow' do
it 'returns { target_account_id => true }' do
Fabricate(:follow, account: account, target_account: target_account)
is_expected.to eq(target_account_id => { reblogs: true, notify: false, languages: nil })
expect(subject).to eq(target_account_id => { reblogs: true, notify: false, languages: nil })
end
end
context 'account without Follow' do
it 'returns {}' do
is_expected.to eq({})
expect(subject).to eq({})
end
end
end
@ -31,13 +31,13 @@ describe AccountInteractions do
context 'account with Follow' do
it 'returns { target_account_id => true }' do
Fabricate(:follow, account: target_account, target_account: account)
is_expected.to eq(target_account_id => true)
expect(subject).to eq(target_account_id => true)
end
end
context 'account without Follow' do
it 'returns {}' do
is_expected.to eq({})
expect(subject).to eq({})
end
end
end
@ -48,13 +48,13 @@ describe AccountInteractions do
context 'account with Block' do
it 'returns { target_account_id => true }' do
Fabricate(:block, account: account, target_account: target_account)
is_expected.to eq(target_account_id => true)
expect(subject).to eq(target_account_id => true)
end
end
context 'account without Block' do
it 'returns {}' do
is_expected.to eq({})
expect(subject).to eq({})
end
end
end
@ -71,7 +71,7 @@ describe AccountInteractions do
let(:hide) { true }
it 'returns { target_account_id => { notifications: true } }' do
is_expected.to eq(target_account_id => { notifications: true })
expect(subject).to eq(target_account_id => { notifications: true })
end
end
@ -79,14 +79,14 @@ describe AccountInteractions do
let(:hide) { false }
it 'returns { target_account_id => { notifications: false } }' do
is_expected.to eq(target_account_id => { notifications: false })
expect(subject).to eq(target_account_id => { notifications: false })
end
end
end
context 'account without Mute' do
it 'returns {}' do
is_expected.to eq({})
expect(subject).to eq({})
end
end
end
@ -231,7 +231,7 @@ describe AccountInteractions do
it 'creates and returns ConversationMute' do
expect do
is_expected.to be_a ConversationMute
expect(subject).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_a AccountDomainBlock
expect(subject).to be_a AccountDomainBlock
end.to change { account.domain_blocks.count }.by 1
end
end
@ -254,14 +254,14 @@ 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_a Follow
expect(subject).to be_a Follow
expect(subject).to be_destroyed
end
end
context 'not following target_account' do
it 'returns nil' do
is_expected.to be_nil
expect(subject).to be_nil
end
end
end
@ -272,14 +272,14 @@ 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_a Block
expect(subject).to be_a Block
expect(subject).to be_destroyed
end
end
context 'not blocking target_account' do
it 'returns nil' do
is_expected.to be_nil
expect(subject).to be_nil
end
end
end
@ -290,14 +290,14 @@ 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_a Mute
expect(subject).to be_a Mute
expect(subject).to be_destroyed
end
end
context 'not muting target_account' do
it 'returns nil' do
is_expected.to be_nil
expect(subject).to be_nil
end
end
end
@ -310,14 +310,14 @@ describe AccountInteractions do
context 'muting the conversation' do
it 'returns destroyed ConversationMute' do
account.conversation_mutes.create(conversation: conversation)
is_expected.to be_a ConversationMute
expect(subject).to be_a ConversationMute
expect(subject).to be_destroyed
end
end
context 'not muting the conversation' do
it 'returns nil' do
is_expected.to be_nil
expect(subject).to be_nil
end
end
end
@ -331,14 +331,14 @@ 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_a AccountDomainBlock
expect(subject).to be_a AccountDomainBlock
expect(subject).to be_destroyed
end
end
context 'unblocking the domain' do
it 'returns nil' do
is_expected.to be_nil
expect(subject).to be_nil
end
end
end
@ -349,13 +349,13 @@ describe AccountInteractions do
context 'following target_account' do
it 'returns true' do
account.active_relationships.create(target_account: target_account)
is_expected.to be true
expect(subject).to be true
end
end
context 'not following target_account' do
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -366,13 +366,13 @@ describe AccountInteractions do
context 'followed by target_account' do
it 'returns true' do
account.passive_relationships.create(account: target_account)
is_expected.to be true
expect(subject).to be true
end
end
context 'not followed by target_account' do
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -383,13 +383,13 @@ describe AccountInteractions do
context 'blocking target_account' do
it 'returns true' do
account.block_relationships.create(target_account: target_account)
is_expected.to be true
expect(subject).to be true
end
end
context 'not blocking target_account' do
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -403,13 +403,13 @@ describe AccountInteractions do
it 'returns true' do
account_domain_block = Fabricate(:account_domain_block, domain: domain)
account.domain_blocks << account_domain_block
is_expected.to be true
expect(subject).to be true
end
end
context 'not blocking the domain' do
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -421,13 +421,13 @@ describe AccountInteractions do
it 'returns true' do
mute = Fabricate(:mute, account: account, target_account: target_account)
account.mute_relationships << mute
is_expected.to be true
expect(subject).to be true
end
end
context 'not muting target_account' do
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -440,13 +440,13 @@ describe AccountInteractions do
context 'muting the conversation' do
it 'returns true' do
account.conversation_mutes.create(conversation: conversation)
is_expected.to be true
expect(subject).to be true
end
end
context 'not muting the conversation' do
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -463,7 +463,7 @@ describe AccountInteractions do
let(:hide) { true }
it 'returns true' do
is_expected.to be true
expect(subject).to be true
end
end
@ -471,7 +471,7 @@ describe AccountInteractions do
let(:hide) { false }
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -482,13 +482,13 @@ describe AccountInteractions do
context 'requested by target_account' do
it 'returns true' do
Fabricate(:follow_request, account: account, target_account: target_account)
is_expected.to be true
expect(subject).to be true
end
end
context 'not requested by target_account' do
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -502,7 +502,7 @@ describe AccountInteractions do
let(:favourites) { [Fabricate(:favourite, account: account)] }
it 'returns true' do
is_expected.to be true
expect(subject).to be true
end
end
@ -510,7 +510,7 @@ describe AccountInteractions do
let(:favourites) { [] }
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -524,7 +524,7 @@ describe AccountInteractions do
let(:reblogs) { [Fabricate(:status, account: account)] }
it 'returns true' do
is_expected.to be true
expect(subject).to be true
end
end
@ -532,7 +532,7 @@ describe AccountInteractions do
let(:reblogs) { [] }
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -545,13 +545,13 @@ describe AccountInteractions do
context 'pinned' do
it 'returns true' do
Fabricate(:status_pin, account: account, status: status)
is_expected.to be true
expect(subject).to be true
end
end
context 'not pinned' do
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end

View file

@ -11,7 +11,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:search_term) { 'blobpats' }
it 'finds emoji' do
is_expected.to include(custom_emoji)
expect(subject).to include(custom_emoji)
end
end
@ -20,7 +20,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:search_term) { 'blob' }
it 'finds emoji' do
is_expected.to include(custom_emoji)
expect(subject).to include(custom_emoji)
end
end
end
@ -34,7 +34,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:domain) { nil }
it 'returns true' do
is_expected.to be true
expect(subject).to be true
end
end
@ -42,7 +42,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:domain) { 'example.com' }
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -63,7 +63,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:text) { 'Hello :coolcat:' }
it 'returns records used via shortcodes in text' do
is_expected.to include(emojo)
expect(subject).to include(emojo)
end
end
@ -71,7 +71,7 @@ RSpec.describe CustomEmoji, type: :model do
let(:text) { '<p>Hello :coolcat:</p>' }
it 'returns records used via shortcodes in text' do
is_expected.to include(emojo)
expect(subject).to include(emojo)
end
end
end

View file

@ -10,7 +10,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { '' }
it 'returns true' do
is_expected.to be true
expect(subject).to be true
end
end
@ -18,7 +18,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' }
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -35,7 +35,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' }
it 'returns true' do
is_expected.to be true
expect(subject).to be true
end
end
end
@ -47,7 +47,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { '' }
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
@ -55,7 +55,7 @@ RSpec.describe MediaAttachment, type: :model do
let(:remote_url) { 'remote_url' }
it 'returns true' do
is_expected.to be false
expect(subject).to be false
end
end
end

View file

@ -68,7 +68,7 @@ RSpec.describe Notification, type: :model do
let(:notifications) { [] }
it 'returns []' do
is_expected.to eq []
expect(subject).to eq []
end
end

View file

@ -17,7 +17,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { { acct: 'gargron@quitter.no' } }
it 'returns acct' do
is_expected.to eq 'gargron@quitter.no'
expect(subject).to eq 'gargron@quitter.no'
end
end
@ -25,7 +25,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { {} }
it do
is_expected.to be_nil
expect(subject).to be_nil
end
end
end
@ -37,7 +37,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { { acct: 'gargron@quitter.no' } }
it do
is_expected.to be true
expect(subject).to be true
end
end
@ -45,7 +45,7 @@ RSpec.describe RemoteFollow do
let(:attrs) { {} }
it do
is_expected.to be false
expect(subject).to be false
end
end
end
@ -61,7 +61,7 @@ RSpec.describe RemoteFollow do
subject { remote_follow.subscribe_address_for(account) }
it 'returns subscribe address' do
is_expected.to eq 'https://quitter.no/main/ostatussub?profile=https%3A%2F%2Fcb6e6126.ngrok.io%2Fusers%2Falice'
expect(subject).to eq 'https://quitter.no/main/ostatussub?profile=https%3A%2F%2Fcb6e6126.ngrok.io%2Fusers%2Falice'
end
end
end

View file

@ -33,7 +33,7 @@ describe Report do
end
it 'assigns to a given account' do
is_expected.to eq current_account.id
expect(subject).to eq current_account.id
end
end
@ -48,7 +48,7 @@ describe Report do
end
it 'unassigns' do
is_expected.to be_nil
expect(subject).to be_nil
end
end

View file

@ -44,7 +44,7 @@ RSpec.describe SessionActivation, type: :model do
let(:id) { nil }
it 'returns nil' do
is_expected.to be_nil
expect(subject).to be_nil
end
end
@ -54,7 +54,7 @@ RSpec.describe SessionActivation, type: :model do
context 'id exists as session_id' do
it 'returns true' do
is_expected.to be true
expect(subject).to be true
end
end
@ -64,7 +64,7 @@ RSpec.describe SessionActivation, type: :model do
end
it 'returns false' do
is_expected.to be false
expect(subject).to be false
end
end
end

View file

@ -173,7 +173,7 @@ RSpec.describe Setting, type: :model do
let(:enabled) { false }
it 'returns {}' do
is_expected.to eq({})
expect(subject).to eq({})
end
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_a RailsSettings::Default
expect(subject).to be_a RailsSettings::Default
end
end
end