From 832b92ac3eebb5d65f5c6a6a3d90129e26f2d59f Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 8 Jan 2024 06:05:10 -0500 Subject: [PATCH] Add attachment check to spec/service/suspend_account_service spec (#28619) --- spec/services/suspend_account_service_spec.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/spec/services/suspend_account_service_spec.rb b/spec/services/suspend_account_service_spec.rb index b309ce511e..dcc8dbfd37 100644 --- a/spec/services/suspend_account_service_spec.rb +++ b/spec/services/suspend_account_service_spec.rb @@ -16,17 +16,24 @@ RSpec.describe SuspendAccountService, type: :service do list.accounts << account account.suspend! + + Fabricate(:media_attachment, file: attachment_fixture('boop.ogg'), account: account) end - it 'unmerges from feeds of local followers and preserves suspended flag' do + it 'unmerges from feeds of local followers and changes file mode and preserves suspended flag' do expect { subject } - .to_not change_suspended_flag + .to change_file_mode + .and not_change_suspended_flag expect(FeedManager.instance).to have_received(:unmerge_from_home).with(account, local_follower) expect(FeedManager.instance).to have_received(:unmerge_from_list).with(account, list) end - def change_suspended_flag - change(account, :suspended?) + def change_file_mode + change { File.stat(account.media_attachments.first.file.path).mode } + end + + def not_change_suspended_flag + not_change(account, :suspended?) end end