add vcr cassettes for pixiv tests
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -8,6 +8,7 @@ group :test do
|
||||
gem "simplecov", :require => false
|
||||
gem "pry"
|
||||
gem "vcr"
|
||||
gem "webmock"
|
||||
end
|
||||
|
||||
group :assets do
|
||||
|
||||
@@ -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
|
||||
|
||||
5653
test/fixtures/vcr_cassettes/download-pixiv-html.yml
vendored
Normal file
5653
test/fixtures/vcr_cassettes/download-pixiv-html.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
39721
test/fixtures/vcr_cassettes/download-pixiv-manga.yml
vendored
Normal file
39721
test/fixtures/vcr_cassettes/download-pixiv-manga.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4189
test/fixtures/vcr_cassettes/download-pixiv-small.yml
vendored
Normal file
4189
test/fixtures/vcr_cassettes/download-pixiv-small.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1472
test/fixtures/vcr_cassettes/source-pixiv-unit-test.yml
vendored
Normal file
1472
test/fixtures/vcr_cassettes/source-pixiv-unit-test.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user