闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
774 B

  1. require 'rails_helper'
  2. RSpec.describe MediaAttachment, type: :model do
  3. describe 'animated gif conversion' do
  4. let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('avatar.gif')) }
  5. it 'sets type to gifv' do
  6. expect(media.type).to eq 'gifv'
  7. end
  8. it 'converts original file to mp4' do
  9. expect(media.file_content_type).to eq 'video/mp4'
  10. end
  11. end
  12. describe 'non-animated gif non-conversion' do
  13. let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('attachment.gif')) }
  14. it 'sets type to image' do
  15. expect(media.type).to eq 'image'
  16. end
  17. it 'leaves original file as-is' do
  18. expect(media.file_content_type).to eq 'image/gif'
  19. end
  20. end
  21. end