diff options
author | Starfall <us@starfall.systems> | 2023-07-07 11:49:24 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2023-07-07 11:49:24 -0500 |
commit | a9de0735d2ad2fc615169507ba6215fa17da8c18 (patch) | |
tree | fbf0520231f4f31067b2b6a66d1b7ff701b6d904 /spec | |
parent | 862ffc96153d299402791715766e2584a744dec4 (diff) | |
parent | 0f2adc26fc6aeb82ba7174f14e6b5804f336c381 (diff) |
Merge branch 'main' into hotfix
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fixtures/files/boop.mp3 | bin | 0 -> 7841601 bytes | |||
-rw-r--r-- | spec/models/media_attachment_spec.rb | 20 |
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/fixtures/files/boop.mp3 b/spec/fixtures/files/boop.mp3 new file mode 100644 index 000000000..ba106a3a3 --- /dev/null +++ b/spec/fixtures/files/boop.mp3 Binary files differdiff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb index 63edfc152..1193924fd 100644 --- a/spec/models/media_attachment_spec.rb +++ b/spec/models/media_attachment_spec.rb @@ -152,6 +152,26 @@ RSpec.describe MediaAttachment, type: :model do end end + describe 'mp3 with large cover art' do + let(:media) { described_class.create(account: Fabricate(:account), file: attachment_fixture('boop.mp3')) } + + it 'detects it as an audio file' do + expect(media.type).to eq 'audio' + end + + it 'sets meta for the duration' do + expect(media.file.meta['original']['duration']).to be_within(0.05).of(0.235102) + end + + it 'extracts thumbnail' do + expect(media.thumbnail.present?).to be true + end + + it 'gives the file a random name' do + expect(media.file_file_name).to_not eq 'boop.mp3' + end + end + describe 'jpeg' do let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('attachment.jpg')) } |