refactor twitter service to handle cards (fixes #3031)
This commit is contained in:
@@ -2,6 +2,39 @@ require 'test_helper'
|
||||
|
||||
module Sources
|
||||
class TwitterTest < ActiveSupport::TestCase
|
||||
context "A video" do
|
||||
setup do
|
||||
@site = Sources::Site.new("https://twitter.com/CincinnatiZoo/status/859073537713328129")
|
||||
@site.get
|
||||
end
|
||||
|
||||
should "get the image url" do
|
||||
assert_equal("https://video.twimg.com/ext_tw_video/859073467769126913/pu/vid/1280x720/cPGgVROXHy3yrK6u.mp4", @site.image_url)
|
||||
end
|
||||
end
|
||||
|
||||
context "An animated gif" do
|
||||
setup do
|
||||
@site = Sources::Site.new("https://twitter.com/DaniStrawberry1/status/859435334765088769")
|
||||
@site.get
|
||||
end
|
||||
|
||||
should "get the image url" do
|
||||
assert_equal("https://video.twimg.com/tweet_video/C-1Tns7WsAAqvqn.mp4", @site.image_url)
|
||||
end
|
||||
end
|
||||
|
||||
context "A twitter summary card" do
|
||||
setup do
|
||||
@site = Sources::Site.new("https://twitter.com/NatGeo/status/787654447937847296")
|
||||
@site.get
|
||||
end
|
||||
|
||||
should "get the image url" do
|
||||
assert_equal("http://yourshot.nationalgeographic.com/u/fQYSUbVfts-T7odkrFJckdiFeHvab0GWOfzhj7tYdC0uglagsDcUxj3Tf7HBF3kZEj7S5m-zeDmZP6DBxBJlyJX_1mFp-hGf4JPt97xp0QJkwf4po1MmnZH73WC3a2Pa1Ky62C-v0cYXTur3-QwD3Pz5UI_cKIi81GABTXII8VwKUopxlNW2MYAR8kPYU2IoUhOjlvVefNcLYI74J-0IpI4tHDXE/", @site.image_url)
|
||||
end
|
||||
end
|
||||
|
||||
context "The source site for a restricted twitter" do
|
||||
setup do
|
||||
@site = Sources::Site.new("https://mobile.twitter.com/Strangestone/status/556440271961858051")
|
||||
|
||||
Reference in New Issue
Block a user