refactored pixiv proxy

This commit is contained in:
albert
2011-09-24 11:39:37 -04:00
parent 5f6f2fa659
commit 0e0f2af6ff
6 changed files with 168 additions and 89 deletions

View File

@@ -5,10 +5,11 @@ require 'test_helper'
class PixivProxyTest < ActiveSupport::TestCase
context "The proxy" do
should "get a single post" do
results = PixivProxy.get_single("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=9646484")
assert_equal("member.php?id=4015", results[:profile_url])
assert(results[:jp_tags].size > 0)
first_tag = results[:jp_tags][0]
proxy = ArtSiteProxies::Proxy.new("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=9646484")
assert_equal("member.php?id=4015", proxy.profile_url)
assert(proxy.tags.size > 0)
first_tag = proxy.tags.first
assert_equal(2, first_tag.size)
assert(first_tag[0] =~ /./)
assert(first_tag[1] =~ /tags\.php\?tag=/)