|
|
@ -20,7 +20,14 @@ RSpec.describe MediaAttachment, type: :model do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe 'non-animated gif non-conversion' do |
|
|
|
describe 'non-animated gif non-conversion' do |
|
|
|
let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('attachment.gif')) } |
|
|
|
fixtures = [ |
|
|
|
|
|
|
|
{ filename: 'attachment.gif', width: 600, height: 400, aspect: 1.5 }, |
|
|
|
|
|
|
|
{ filename: 'mini-static.gif', width: 32, height: 32, aspect: 1.0 }, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fixtures.each do |fixture| |
|
|
|
|
|
|
|
context fixture[:filename] do |
|
|
|
|
|
|
|
let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture(fixture[:filename])) } |
|
|
|
|
|
|
|
|
|
|
|
it 'sets type to image' do |
|
|
|
it 'sets type to image' do |
|
|
|
expect(media.type).to eq 'image' |
|
|
|
expect(media.type).to eq 'image' |
|
|
@ -31,9 +38,11 @@ RSpec.describe MediaAttachment, type: :model do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it 'sets meta' do |
|
|
|
it 'sets meta' do |
|
|
|
expect(media.file.meta["original"]["width"]).to eq 600 |
|
|
|
expect(media.file.meta["original"]["width"]).to eq fixture[:width] |
|
|
|
expect(media.file.meta["original"]["height"]).to eq 400 |
|
|
|
expect(media.file.meta["original"]["height"]).to eq fixture[:height] |
|
|
|
expect(media.file.meta["original"]["aspect"]).to eq 1.5 |
|
|
|
expect(media.file.meta["original"]["aspect"]).to eq fixture[:aspect] |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|