FIX: Support pausing GIFs for giphy/tenor oneboxes (#13194)

This commit is contained in:
Penar Musaraj
2021-05-28 08:40:30 -04:00
committed by GitHub
parent 4b8bdd3f72
commit 47e09700fe
6 changed files with 388 additions and 24 deletions

View File

@ -0,0 +1,31 @@
# frozen_string_literal: true
require "rails_helper"
describe Onebox::Engine::AnimatedImageOnebox do
let(:giphy) { "http://gph.is/15bRbWf" }
let(:tenor) { "https://tenor.com/bb3fQ.gif" }
before do
@previous_options = Onebox.options.to_h
Onebox.options = { redirect_limit: 0 }
stub_request(:get, giphy).to_return(status: 200, body: onebox_response("giphy"))
stub_request(:get, tenor).to_return(status: 200, body: onebox_response("tenor"))
end
after do
Onebox.options = @previous_options
end
it "works for giphy short URLs" do
html = described_class.new(giphy).to_html
expect(html).to include("img")
expect(html).to include("class='animated onebox'")
end
it "works for tenor URLs" do
html = described_class.new(tenor).to_html
expect(html).to include("img")
expect(html).to include("class='animated onebox'")
end
end