FIX: IMDb links were being oneboxed as posters (#13310)

IMDb movie links were being rendered as posters. This was because
IMDb was sending `og:type` as `image` randomly in some cases. To
fix this we'll now default all IMDb links as article type. This will
ensure that the IMDb onebox link includes all the information instead
of showing just a poster without any context.
This commit is contained in:
Arpit Jalan
2021-06-07 18:45:59 +05:30
committed by GitHub
parent 2110fd2638
commit 2e4f07678e
3 changed files with 2213 additions and 2 deletions

View File

@@ -182,4 +182,21 @@ describe Onebox::Engine::AllowlistedGenericOnebox do
end
end
end
describe 'article html hosts' do
context 'returns article_html for hosts in article_html_hosts' do
before do
stub_request(:get, "https://www.imdb.com/title/tt0108002/")
.to_return(status: 200, body: onebox_response('imdb'))
end
it 'shows article onebox' do
onebox = described_class.new("https://www.imdb.com/title/tt0108002/")
expect(onebox.to_html).to include("https://www.imdb.com/title/tt0108002")
expect(onebox.to_html).to include("https://m.media-amazon.com/images/M/MV5BZGUzMDU1YmQtMzBkOS00MTNmLTg5ZDQtZjY5Njk4Njk2MmRlXkEyXkFqcGdeQXVyNjc1NTYyMjg@._V1_FMjpg_UX1000_.jpg")
expect(onebox.to_html).to include("Rudy (1993) - IMDb")
expect(onebox.to_html).to include("Rudy: Directed by David Anspaugh. With Sean Astin, Jon Favreau, Ned Beatty, Greta Lind. Rudy has always been told that he was too small to play college football.")
end
end
end
end