Add attachment check to spec/service/suspend_account_service spec (#28619)
parent
2ae53e655c
commit
832b92ac3e
|
@ -16,17 +16,24 @@ RSpec.describe SuspendAccountService, type: :service do
|
||||||
list.accounts << account
|
list.accounts << account
|
||||||
|
|
||||||
account.suspend!
|
account.suspend!
|
||||||
|
|
||||||
|
Fabricate(:media_attachment, file: attachment_fixture('boop.ogg'), account: account)
|
||||||
end
|
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 }
|
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_home).with(account, local_follower)
|
||||||
expect(FeedManager.instance).to have_received(:unmerge_from_list).with(account, list)
|
expect(FeedManager.instance).to have_received(:unmerge_from_list).with(account, list)
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_suspended_flag
|
def change_file_mode
|
||||||
change(account, :suspended?)
|
change { File.stat(account.media_attachments.first.file.path).mode }
|
||||||
|
end
|
||||||
|
|
||||||
|
def not_change_suspended_flag
|
||||||
|
not_change(account, :suspended?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue