diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-09-30 00:29:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-30 00:29:38 +0200 |
commit | 5e36c3b44c052afb1aa61e2405c595c726bc9503 (patch) | |
tree | 899cb5f54098d08f28dad2c8ee555b3557dead16 /spec | |
parent | 00889b313176308018d66e54b5cb7dcc92da1587 (diff) | |
parent | 29b5c5f4830f9bda0af352b1d6ac73830a6cfd4e (diff) |
Merge pull request #1612 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fixtures/files/boop.ogg | bin | 0 -> 11379 bytes | |||
-rw-r--r-- | spec/models/media_attachment_spec.rb | 24 |
2 files changed, 24 insertions, 0 deletions
diff --git a/spec/fixtures/files/boop.ogg b/spec/fixtures/files/boop.ogg new file mode 100644 index 000000000..23cbbedb1 --- /dev/null +++ b/spec/fixtures/files/boop.ogg Binary files differdiff --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')) } |