From c99f88e1a8ac1bbd4967e65c12717862a7dd00fd Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 21 Dec 2023 06:19:56 -0500 Subject: [PATCH] Clean up of `RSpec/LetSetup` within `spec/lib` (#28447) --- .rubocop_todo.yml | 3 --- spec/lib/activitypub/activity/delete_spec.rb | 4 ++++ spec/lib/vacuum/applications_vacuum_spec.rb | 8 ++++---- spec/lib/vacuum/preview_cards_vacuum_spec.rb | 4 ++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8bee220d722..645faa60486 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -50,9 +50,6 @@ RSpec/LetSetup: - 'spec/controllers/auth/confirmations_controller_spec.rb' - 'spec/controllers/auth/passwords_controller_spec.rb' - 'spec/controllers/auth/sessions_controller_spec.rb' - - 'spec/lib/activitypub/activity/delete_spec.rb' - - 'spec/lib/vacuum/applications_vacuum_spec.rb' - - 'spec/lib/vacuum/preview_cards_vacuum_spec.rb' - 'spec/models/account_statuses_cleanup_policy_spec.rb' - 'spec/models/status_spec.rb' - 'spec/services/account_statuses_cleanup_service_spec.rb' diff --git a/spec/lib/activitypub/activity/delete_spec.rb b/spec/lib/activitypub/activity/delete_spec.rb index 3a73b3726c9..aec2c71e58a 100644 --- a/spec/lib/activitypub/activity/delete_spec.rb +++ b/spec/lib/activitypub/activity/delete_spec.rb @@ -50,6 +50,10 @@ RSpec.describe ActivityPub::Activity::Delete do it 'sends delete activity to followers of rebloggers' do expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once end + + it 'deletes the reblog' do + expect { reblog.reload }.to raise_error(ActiveRecord::RecordNotFound) + end end end diff --git a/spec/lib/vacuum/applications_vacuum_spec.rb b/spec/lib/vacuum/applications_vacuum_spec.rb index 57a222aafc8..df5c8606027 100644 --- a/spec/lib/vacuum/applications_vacuum_spec.rb +++ b/spec/lib/vacuum/applications_vacuum_spec.rb @@ -13,11 +13,11 @@ RSpec.describe Vacuum::ApplicationsVacuum do let!(:unused_app) { Fabricate(:application, created_at: 1.month.ago) } let!(:recent_app) { Fabricate(:application, created_at: 1.hour.ago) } - let!(:active_access_token) { Fabricate(:access_token, application: app_with_token) } - let!(:active_access_grant) { Fabricate(:access_grant, application: app_with_grant) } - let!(:user) { Fabricate(:user, created_by_application: app_with_signup) } - before do + Fabricate(:access_token, application: app_with_token) + Fabricate(:access_grant, application: app_with_grant) + Fabricate(:user, created_by_application: app_with_signup) + subject.perform end diff --git a/spec/lib/vacuum/preview_cards_vacuum_spec.rb b/spec/lib/vacuum/preview_cards_vacuum_spec.rb index c1b7f7e9c50..9dbdf0bc2fe 100644 --- a/spec/lib/vacuum/preview_cards_vacuum_spec.rb +++ b/spec/lib/vacuum/preview_cards_vacuum_spec.rb @@ -30,5 +30,9 @@ RSpec.describe Vacuum::PreviewCardsVacuum do it 'does not delete attached preview cards' do expect(new_preview_card.reload).to be_persisted end + + it 'does not delete orphaned preview cards in the retention period' do + expect(orphaned_preview_card.reload).to be_persisted + end end end