add vcr cassettes for pixiv tests

This commit is contained in:
r888888888
2013-04-30 17:35:24 -07:00
parent dc58621c28
commit 850270dafa
9 changed files with 51060 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ group :test do
gem "simplecov", :require => false
gem "pry"
gem "vcr"
gem "webmock"
end
group :assets do

View File

@@ -53,6 +53,7 @@ GEM
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.4)
arel (3.0.2)
awesome_print (1.1.0)
aws-s3 (0.6.3)
@@ -73,6 +74,7 @@ GEM
capistrano
chronic (0.9.1)
coderay (1.0.9)
crack (0.3.2)
daemons (1.1.9)
delayed_job (3.0.5)
activesupport (~> 3.0)
@@ -198,6 +200,9 @@ GEM
rack
raindrops (~> 0.7)
vcr (2.4.0)
webmock (1.11.0)
addressable (>= 2.2.7)
crack (>= 0.3.2)
webrobots (0.1.1)
whenever (0.8.2)
activesupport (>= 2.3.4)
@@ -240,4 +245,5 @@ DEPENDENCIES
uglifier (>= 1.0.3)
unicorn
vcr
webmock
whenever

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -89,3 +89,9 @@ class MockMemcache
end
MEMCACHE = MockMemcache.new
VCR.configure do |c|
c.cassette_library_dir = "test/fixtures/vcr_cassettes"
c.hook_into :webmock
c.allow_http_connections_when_no_cassette = true
end

View File

@@ -7,7 +7,9 @@ module Downloads
@source = "http://img65.pixiv.net/img/kiyoringo/21755794_p2.png"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
@download.download!
VCR.use_cassette("download-pixiv-manga", :record => :new_episodes) do
@download.download!
end
end
should "instead download the big version" do
@@ -21,7 +23,9 @@ module Downloads
@source = "http://www.pixiv.net/member_illust.php?mode=big&illust_id=4348318"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
@download.download!
VCR.use_cassette("download-pixiv-html", :record => :new_episodes) do
@download.download!
end
end
should "work" do
@@ -34,7 +38,9 @@ module Downloads
@source = "http://img02.pixiv.net/img/wanwandoh/4348318_m.jpg"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
@download.download!
VCR.use_cassette("download-pixiv-small", :record => :new_episodes) do
@download.download!
end
end
should "instead download the original version" do

View File

@@ -6,8 +6,9 @@ module Sources
class PixivTest < ActiveSupport::TestCase
context "The source site for pixiv" do
setup do
@site = Sources::Site.new("http://www.pixiv.net/member_illust.php?mode=big&illust_id=9646484")
@site.get
VCR.use_cassette("source-pixiv-unit-test", :record => :new_episodes) do
@site = Sources::Site.new("http://www.pixiv.net/member_illust.php?mode=big&illust_id=9646484")
end
end
should "get the profile" do