2
0

Add Status::MEDIA_ATTACHMENTS_LIMIT configuration constant (#30433)

This commit is contained in:
Matt Jankowski
2024-05-27 05:49:44 -04:00
committed by GitHub
parent 87156f57b5
commit c61e356475
9 changed files with 15 additions and 12 deletions

View File

@@ -228,14 +228,15 @@ RSpec.describe PostStatusService do
expect(media.reload.status).to be_nil
end
it 'does not allow attaching more than 4 files' do
it 'does not allow attaching more files than configured limit' do
stub_const('Status::MEDIA_ATTACHMENTS_LIMIT', 1)
account = Fabricate(:account)
expect do
subject.call(
account,
text: 'test status update',
media_ids: Array.new(5) { Fabricate(:media_attachment, account: account) }.map(&:id)
media_ids: Array.new(2) { Fabricate(:media_attachment, account: account) }.map(&:id)
)
end.to raise_error(
Mastodon::ValidationError,