Use webmock instead of fakeweb for VCR; Fix tests; Use Timecop to speed up tests previously using sleep; Move artist rename into seperate operation
This commit is contained in:
2643
test/fixtures/vcr_cassettes/download-pixiv-html.yml
vendored
2643
test/fixtures/vcr_cassettes/download-pixiv-html.yml
vendored
File diff suppressed because it is too large
Load Diff
@@ -7,44 +7,44 @@ http_interactions:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
referer:
|
||||
Referer:
|
||||
- http://www.pixiv.net
|
||||
user-agent:
|
||||
- ./2.8.0
|
||||
accept:
|
||||
User-Agent:
|
||||
- ./2.12.0
|
||||
Accept:
|
||||
- ! '*/*'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
server:
|
||||
Server:
|
||||
- nginx
|
||||
date:
|
||||
- Fri, 03 May 2013 23:23:12 GMT
|
||||
content-type:
|
||||
Date:
|
||||
- Fri, 24 May 2013 19:51:22 GMT
|
||||
Content-Type:
|
||||
- image/png
|
||||
content-length:
|
||||
Content-Length:
|
||||
- '1782713'
|
||||
connection:
|
||||
Connection:
|
||||
- keep-alive
|
||||
last-modified:
|
||||
Last-Modified:
|
||||
- Wed, 14 Sep 2011 17:28:13 GMT
|
||||
etag:
|
||||
Etag:
|
||||
- ! '"2e3303bf-1b33b9-4acea15afa540"'
|
||||
accept-ranges:
|
||||
Accept-Ranges:
|
||||
- bytes
|
||||
cache-control:
|
||||
Cache-Control:
|
||||
- max-age=1209600
|
||||
expires:
|
||||
- Fri, 17 May 2013 23:23:12 GMT
|
||||
age:
|
||||
- '0'
|
||||
Expires:
|
||||
- Fri, 07 Jun 2013 00:30:29 GMT
|
||||
Age:
|
||||
- '69653'
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
http_version: '1.1'
|
||||
recorded_at: Fri, 03 May 2013 23:23:12 GMT
|
||||
http_version:
|
||||
recorded_at: Fri, 24 May 2013 19:51:22 GMT
|
||||
- request:
|
||||
method: get
|
||||
uri: http://img65.pixiv.net/img/kiyoringo/21755794_big_p2.png
|
||||
@@ -52,39 +52,39 @@ http_interactions:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
user-agent:
|
||||
- _/2.8.0
|
||||
referer:
|
||||
User-Agent:
|
||||
- _/2.12.0
|
||||
Referer:
|
||||
- http://www.pixiv.net
|
||||
accept:
|
||||
Accept:
|
||||
- ! '*/*'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
server:
|
||||
Server:
|
||||
- nginx
|
||||
date:
|
||||
- Fri, 03 May 2013 23:23:12 GMT
|
||||
content-type:
|
||||
Date:
|
||||
- Fri, 24 May 2013 19:51:22 GMT
|
||||
Content-Type:
|
||||
- image/png
|
||||
content-length:
|
||||
Content-Length:
|
||||
- '1782713'
|
||||
connection:
|
||||
Connection:
|
||||
- keep-alive
|
||||
last-modified:
|
||||
Last-Modified:
|
||||
- Wed, 14 Sep 2011 17:28:13 GMT
|
||||
etag:
|
||||
Etag:
|
||||
- ! '"2e3303bf-1b33b9-4acea15afa540"'
|
||||
accept-ranges:
|
||||
Accept-Ranges:
|
||||
- bytes
|
||||
cache-control:
|
||||
Cache-Control:
|
||||
- max-age=1209600
|
||||
expires:
|
||||
- Fri, 17 May 2013 23:23:12 GMT
|
||||
age:
|
||||
- '0'
|
||||
Expires:
|
||||
- Fri, 07 Jun 2013 00:30:29 GMT
|
||||
Age:
|
||||
- '69653'
|
||||
body:
|
||||
encoding: ASCII-8BIT
|
||||
string: !binary |-
|
||||
@@ -39704,6 +39704,6 @@ http_interactions:
|
||||
AgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAAB
|
||||
AgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAAB
|
||||
AgQIECBAgAABAgQIECDwAYE/YMgpRKYZ7IsAAAAASUVORK5CYII=
|
||||
http_version: '1.1'
|
||||
recorded_at: Fri, 03 May 2013 23:23:17 GMT
|
||||
http_version:
|
||||
recorded_at: Fri, 24 May 2013 19:51:25 GMT
|
||||
recorded_with: VCR 2.4.0
|
||||
|
||||
@@ -7,51 +7,39 @@ http_interactions:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
user-agent:
|
||||
- _/2.8.0
|
||||
referer:
|
||||
User-Agent:
|
||||
- _/2.12.0
|
||||
Referer:
|
||||
- http://www.pixiv.net
|
||||
accept:
|
||||
Accept:
|
||||
- ! '*/*'
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: !binary |-
|
||||
T0s=
|
||||
message: OK
|
||||
headers:
|
||||
!binary "c2VydmVy":
|
||||
- !binary |-
|
||||
bmdpbng=
|
||||
!binary "ZGF0ZQ==":
|
||||
- !binary |-
|
||||
RnJpLCAwMyBNYXkgMjAxMyAyMzoyMzoxOCBHTVQ=
|
||||
!binary "Y29udGVudC10eXBl":
|
||||
- !binary |-
|
||||
aW1hZ2UvanBlZw==
|
||||
!binary "Y29udGVudC1sZW5ndGg=":
|
||||
- !binary |-
|
||||
MTg1Nzc4
|
||||
!binary "Y29ubmVjdGlvbg==":
|
||||
- !binary |-
|
||||
a2VlcC1hbGl2ZQ==
|
||||
!binary "bGFzdC1tb2RpZmllZA==":
|
||||
- !binary |-
|
||||
VHVlLCAxOSBNYXkgMjAwOSAyMzozNDoxMSBHTVQ=
|
||||
!binary "ZXRhZw==":
|
||||
- !binary |-
|
||||
ImFkZDExYzktMmQ1YjItNDZhNGM1OTBlMjJjMCI=
|
||||
!binary "YWNjZXB0LXJhbmdlcw==":
|
||||
- !binary |-
|
||||
Ynl0ZXM=
|
||||
!binary "Y2FjaGUtY29udHJvbA==":
|
||||
- !binary |-
|
||||
bWF4LWFnZT0xMjA5NjAw
|
||||
!binary "ZXhwaXJlcw==":
|
||||
- !binary |-
|
||||
RnJpLCAxNyBNYXkgMjAxMyAxMTozMTozMyBHTVQ=
|
||||
!binary "YWdl":
|
||||
- !binary |-
|
||||
NDI3MDU=
|
||||
Server:
|
||||
- nginx
|
||||
Date:
|
||||
- Fri, 24 May 2013 19:51:25 GMT
|
||||
Content-Type:
|
||||
- image/jpeg
|
||||
Content-Length:
|
||||
- '185778'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Last-Modified:
|
||||
- Tue, 19 May 2009 23:34:11 GMT
|
||||
Etag:
|
||||
- ! '"add11c9-2d5b2-46a4c590e22c0"'
|
||||
Accept-Ranges:
|
||||
- bytes
|
||||
Cache-Control:
|
||||
- max-age=1209600
|
||||
Expires:
|
||||
- Thu, 06 Jun 2013 22:56:47 GMT
|
||||
Age:
|
||||
- '75278'
|
||||
body:
|
||||
encoding: ASCII-8BIT
|
||||
string: !binary |-
|
||||
@@ -4184,7 +4172,6 @@ http_interactions:
|
||||
DvGOzZcGUrHy3Ep4MunzY5Ue4KSoe+oGXGtuq4FVkqjqSa+gLfx3N0nxMF54
|
||||
uS9vPLxbgUolXkf60QkHs5F291RMWfqRh/kmOpY7fIklQbpB7wD9danFlWB5
|
||||
bJUdD6Cp8Tgup+OwhWnRD//Z
|
||||
http_version: !binary |-
|
||||
MS4x
|
||||
recorded_at: Fri, 03 May 2013 23:23:18 GMT
|
||||
http_version:
|
||||
recorded_at: Fri, 24 May 2013 19:51:26 GMT
|
||||
recorded_with: VCR 2.4.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
2614
test/fixtures/vcr_cassettes/source-pixiv-unit-test.yml
vendored
2614
test/fixtures/vcr_cassettes/source-pixiv-unit-test.yml
vendored
File diff suppressed because it is too large
Load Diff
@@ -92,6 +92,6 @@ MEMCACHE = MockMemcache.new
|
||||
|
||||
VCR.configure do |c|
|
||||
c.cassette_library_dir = "test/fixtures/vcr_cassettes"
|
||||
c.hook_into :fakeweb
|
||||
c.hook_into :webmock
|
||||
c.allow_http_connections_when_no_cassette = true
|
||||
end
|
||||
|
||||
@@ -67,8 +67,9 @@ class CommentTest < ActiveSupport::TestCase
|
||||
Danbooru.config.stubs(:comment_threshold).returns(1)
|
||||
p = FactoryGirl.create(:post)
|
||||
c1 = FactoryGirl.create(:comment, :post => p)
|
||||
sleep 1
|
||||
c2 = FactoryGirl.create(:comment, :post => p)
|
||||
Timecop.travel(2.seconds.from_now) do
|
||||
c2 = FactoryGirl.create(:comment, :post => p)
|
||||
end
|
||||
p.reload
|
||||
assert_equal(c1.created_at.to_s, p.last_commented_at.to_s)
|
||||
end
|
||||
|
||||
@@ -21,8 +21,9 @@ class ForumPostTest < ActiveSupport::TestCase
|
||||
9.times do
|
||||
@posts << FactoryGirl.create(:forum_post, :topic_id => @topic.id, :body => rand(100_000))
|
||||
end
|
||||
sleep 2
|
||||
@posts << FactoryGirl.create(:forum_post, :topic_id => @topic.id, :body => rand(100_000))
|
||||
Timecop.travel(2.seconds.from_now) do
|
||||
@posts << FactoryGirl.create(:forum_post, :topic_id => @topic.id, :body => rand(100_000))
|
||||
end
|
||||
end
|
||||
|
||||
should "know which page it's on" do
|
||||
@@ -59,11 +60,12 @@ class ForumPostTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "update its parent when saved" do
|
||||
sleep 1
|
||||
original_topic_updated_at = @topic.updated_at
|
||||
Timecop.travel(1.second.from_now) do
|
||||
@original_topic_updated_at = @topic.updated_at
|
||||
end
|
||||
post = FactoryGirl.create(:forum_post, :topic_id => @topic.id)
|
||||
@topic.reload
|
||||
assert_not_equal(original_topic_updated_at, @topic.updated_at)
|
||||
assert_not_equal(@original_topic_updated_at, @topic.updated_at)
|
||||
end
|
||||
|
||||
should "be searchable by body content" do
|
||||
|
||||
Reference in New Issue
Block a user