0
0
Fork 0

Autofix Rubocops RSpec/ScatteredLet (#23725)

This commit is contained in:
Nick Schonning 2023-02-19 21:17:41 -05:00 committed by GitHub
parent aef0051fd0
commit 5179c47087
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 56 additions and 83 deletions

View file

@ -753,10 +753,6 @@ RSpec.describe ActivityPub::Activity::Create do
context 'with an encrypted message' do
let(:recipient) { Fabricate(:account) }
let(:target_device) { Fabricate(:device, account: recipient) }
subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -778,6 +774,9 @@ RSpec.describe ActivityPub::Activity::Create do
},
}
end
let(:target_device) { Fabricate(:device, account: recipient) }
subject { described_class.new(json, sender, delivery: true, delivered_to_account_id: recipient.id) }
before do
subject.perform
@ -833,13 +832,6 @@ RSpec.describe ActivityPub::Activity::Create do
context 'when sender replies to local status' do
let!(:local_status) { Fabricate(:status) }
subject { described_class.new(json, sender, delivery: true) }
before do
subject.perform
end
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -849,6 +841,12 @@ RSpec.describe ActivityPub::Activity::Create do
}
end
subject { described_class.new(json, sender, delivery: true) }
before do
subject.perform
end
it 'creates status' do
status = sender.statuses.first
@ -859,13 +857,6 @@ RSpec.describe ActivityPub::Activity::Create do
context 'when sender targets a local user' do
let!(:local_account) { Fabricate(:account) }
subject { described_class.new(json, sender, delivery: true) }
before do
subject.perform
end
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -875,6 +866,12 @@ RSpec.describe ActivityPub::Activity::Create do
}
end
subject { described_class.new(json, sender, delivery: true) }
before do
subject.perform
end
it 'creates status' do
status = sender.statuses.first
@ -885,13 +882,6 @@ RSpec.describe ActivityPub::Activity::Create do
context 'when sender cc\'s a local user' do
let!(:local_account) { Fabricate(:account) }
subject { described_class.new(json, sender, delivery: true) }
before do
subject.perform
end
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
@ -901,6 +891,12 @@ RSpec.describe ActivityPub::Activity::Create do
}
end
subject { described_class.new(json, sender, delivery: true) }
before do
subject.perform
end
it 'creates status' do
status = sender.statuses.first

View file

@ -2,12 +2,11 @@ require 'rails_helper'
RSpec.describe Vacuum::MediaAttachmentsVacuum do
let(:retention_period) { 7.days }
subject { described_class.new(retention_period) }
let(:remote_status) { Fabricate(:status, account: Fabricate(:account, domain: 'example.com')) }
let(:local_status) { Fabricate(:status) }
subject { described_class.new(retention_period) }
describe '#perform' do
let!(:old_remote_media) { Fabricate(:media_attachment, remote_url: 'https://example.com/foo.png', status: remote_status, created_at: (retention_period + 1.day).ago, updated_at: (retention_period + 1.day).ago) }
let!(:old_local_media) { Fabricate(:media_attachment, status: local_status, created_at: (retention_period + 1.day).ago, updated_at: (retention_period + 1.day).ago) }