This commit is contained in:
r888888888
2015-01-24 12:11:39 -08:00
parent b2b14cba98
commit a07410aece
5 changed files with 824 additions and 22 deletions

View File

@@ -2,33 +2,46 @@ require 'test_helper'
module Sources
class TwitterTest < ActiveSupport::TestCase
context "The source site for a restricted twitter" do
setup do
VCR.use_cassette("source-twitter-unit-test-2", :record => :none) do
@site = Sources::Site.new("https://mobile.twitter.com/Strangestone/status/556440271961858051")
@site.get
end
end
should "get the image url" do
assert_equal("https://pbs.twimg.com/media/B7jfc1JCcAEyeJh.png:large", @site.image_url)
end
end
context "The source site for twitter" do
setup do
VCR.use_cassette("source-twitter-unit-test-1", :record => :none) do
@site_1 = Sources::Site.new("https://mobile.twitter.com/nounproject/status/540944400767922176")
@site_1.get
@site = Sources::Site.new("https://mobile.twitter.com/nounproject/status/540944400767922176")
@site.get
end
end
should "get the profile" do
assert_equal("https://twitter.com/nounproject", @site_1.profile_url)
assert_equal("https://twitter.com/nounproject", @site.profile_url)
end
should "get the artist name" do
assert_equal("The Noun Project", @site_1.artist_name)
assert_equal("The Noun Project", @site.artist_name)
end
should "get the image url" do
assert_equal("https://pbs.twimg.com/media/B4HSEP5CUAA4xyu.png:large", @site_1.image_url)
assert_equal("https://pbs.twimg.com/media/B4HSEP5CUAA4xyu.png:large", @site.image_url)
end
should "get the tags" do
assert_equal([], @site_1.tags)
assert_equal([], @site.tags)
end
should "convert a page into a json representation" do
assert_nothing_raised do
@site_1.to_json
@site.to_json
end
end
end