2020-10-16 18:41:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-28 10:27:38 +08:00
|
|
|
RSpec.describe Jobs::UpdateAnimatedUploads do
|
2020-10-16 18:41:27 +08:00
|
|
|
let!(:upload) { Fabricate(:upload) }
|
|
|
|
let!(:gif_upload) { Fabricate(:upload, extension: "gif") }
|
|
|
|
|
2020-10-21 00:11:43 +08:00
|
|
|
before do
|
2020-10-16 18:41:27 +08:00
|
|
|
url = Discourse.store.path_for(gif_upload) || gif_upload.url
|
|
|
|
FastImage.expects(:animated?).with(url).returns(true).once
|
2020-10-21 00:11:43 +08:00
|
|
|
end
|
2020-10-16 18:41:27 +08:00
|
|
|
|
2020-10-21 00:11:43 +08:00
|
|
|
it "affects only GIF uploads" do
|
2020-10-16 18:41:27 +08:00
|
|
|
described_class.new.execute({})
|
|
|
|
|
|
|
|
expect(upload.reload.animated).to eq(nil)
|
|
|
|
expect(gif_upload.reload.animated).to eq(true)
|
|
|
|
end
|
2020-10-21 00:11:43 +08: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 18:41:27 +08:00
|
|
|
end
|