diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-09-30 00:01:20 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2021-09-30 00:01:20 +0200 |
commit | 29b5c5f4830f9bda0af352b1d6ac73830a6cfd4e (patch) | |
tree | 899cb5f54098d08f28dad2c8ee555b3557dead16 /spec/models | |
parent | 00889b313176308018d66e54b5cb7dcc92da1587 (diff) | |
parent | fc3ae1343df5adb83a3733958a4436981feb380f (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/models/custom_emoji.rb`: Slight refactor upstream, next to a line that was different in glitch-soc because of our local configurable limits on custom emoji size. Ported upstream changes. - `yarn.lock`: Not really a conflict, upstream dependency textually too close to a glitch-soc-only dependency. Updated upstream dependency as upstream.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/media_attachment_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb index 456bc4216..edab67d47 100644 --- a/spec/models/media_attachment_spec.rb +++ b/spec/models/media_attachment_spec.rb @@ -114,6 +114,30 @@ RSpec.describe MediaAttachment, type: :model do end end + describe 'ogg with cover art' do + let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('boop.ogg')) } + + 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 eq true + end + + it 'extracts colors from thumbnail' do + expect(media.file.meta['colors']['background']).to eq '#3088d4' + end + + it 'gives the file a random name' do + expect(media.file_file_name).to_not eq 'boop.ogg' + end + end + describe 'jpeg' do let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('attachment.jpg')) } |