Update rubocop-rspec to version 2.22.0, fix RSpec/IndexedLet cop (#24698)

This commit is contained in:
Matt Jankowski
2023-06-14 10:44:37 -04:00
committed by GitHub
parent 24015ef0cc
commit 4c5aa0e470
25 changed files with 334 additions and 322 deletions

View File

@@ -6,9 +6,9 @@ RSpec.describe BlockDomainService, type: :service do
subject { described_class.new }
let!(:bad_account) { Fabricate(:account, username: 'badguy666', domain: 'evil.org') }
let!(:bad_status1) { Fabricate(:status, account: bad_account, text: 'You suck') }
let!(:bad_status2) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
let!(:bad_attachment) { Fabricate(:media_attachment, account: bad_account, status: bad_status2, file: attachment_fixture('attachment.jpg')) }
let!(:bad_status_plain) { Fabricate(:status, account: bad_account, text: 'You suck') }
let!(:bad_status_with_attachment) { Fabricate(:status, account: bad_account, text: 'Hahaha') }
let!(:bad_attachment) { Fabricate(:media_attachment, account: bad_account, status: bad_status_with_attachment, file: attachment_fixture('attachment.jpg')) }
let!(:already_banned_account) { Fabricate(:account, username: 'badguy', domain: 'evil.org', suspended: true, silenced: true) }
describe 'for a suspension' do
@@ -37,8 +37,8 @@ RSpec.describe BlockDomainService, type: :service do
end
it 'removes the remote accounts\'s statuses and media attachments' do
expect { bad_status1.reload }.to raise_exception ActiveRecord::RecordNotFound
expect { bad_status2.reload }.to raise_exception ActiveRecord::RecordNotFound
expect { bad_status_plain.reload }.to raise_exception ActiveRecord::RecordNotFound
expect { bad_status_with_attachment.reload }.to raise_exception ActiveRecord::RecordNotFound
expect { bad_attachment.reload }.to raise_exception ActiveRecord::RecordNotFound
end
end
@@ -69,8 +69,8 @@ RSpec.describe BlockDomainService, type: :service do
end
it 'leaves the domains status and attachments, but clears media' do
expect { bad_status1.reload }.to_not raise_error
expect { bad_status2.reload }.to_not raise_error
expect { bad_status_plain.reload }.to_not raise_error
expect { bad_status_with_attachment.reload }.to_not raise_error
expect { bad_attachment.reload }.to_not raise_error
expect(bad_attachment.file.exists?).to be false
end