2020-10-16 06:41:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-27 22:27:38 -04:00
|
|
|
RSpec.describe Jobs::UpdateAnimatedUploads do
|
2020-10-16 06:41:27 -04:00
|
|
|
let!(:upload) { Fabricate(:upload) }
|
|
|
|
let!(:gif_upload) { Fabricate(:upload, extension: "gif") }
|
|
|
|
|
2020-10-20 12:11:43 -04:00
|
|
|
before do
|
2020-10-16 06:41:27 -04:00
|
|
|
url = Discourse.store.path_for(gif_upload) || gif_upload.url
|
|
|
|
FastImage.expects(:animated?).with(url).returns(true).once
|
2020-10-20 12:11:43 -04:00
|
|
|
end
|
2020-10-16 06:41:27 -04:00
|
|
|
|
2020-10-20 12:11:43 -04:00
|
|
|
it "affects only GIF uploads" do
|
2020-10-16 06:41:27 -04:00
|
|
|
described_class.new.execute({})
|
|
|
|
|
|
|
|
expect(upload.reload.animated).to eq(nil)
|
|
|
|
expect(gif_upload.reload.animated).to eq(true)
|
|
|
|
end
|
2020-10-20 12:11:43 -04:00
|
|
|
|
|
|
|
it "works with uploads larger than current limits" do
|
|
|
|
SiteSetting.max_image_size_kb = 1
|
|
|
|
|
|
|
|
described_class.new.execute({})
|
|
|
|
|
|
|
|
expect(gif_upload.reload.animated).to eq(true)
|
|
|
|
end
|
2020-10-16 06:41:27 -04:00
|
|
|
end
|