fix tests
This commit is contained in:
@@ -749,7 +749,7 @@ http_interactions:
|
|||||||
recorded_at: Wed, 22 Oct 2014 23:29:57 GMT
|
recorded_at: Wed, 22 Oct 2014 23:29:57 GMT
|
||||||
- request:
|
- request:
|
||||||
method: get
|
method: get
|
||||||
uri: http://i1.pixiv.net/img-zip-ugoira/img/2014/10/05/23/42/23/46378654_ugoira1920x1080.zip
|
uri: http://i3.pixiv.net/img-zip-ugoira/img/2014/10/05/23/42/23/46378654_ugoira1920x1080.zip
|
||||||
body:
|
body:
|
||||||
encoding: US-ASCII
|
encoding: US-ASCII
|
||||||
string: ''
|
string: ''
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ class BulkUpdateRequestsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
context "for the creator" do
|
context "for the creator" do
|
||||||
should "succeed" do
|
should "succeed" do
|
||||||
assert_difference("BulkUpdateRequest.count", -1) do
|
delete :destroy, {:id => @bulk_update_request.id}, {:user_id => @user.id}
|
||||||
delete :destroy, {:id => @bulk_update_request.id}, {:user_id => @user.id}
|
@bulk_update_request.reload
|
||||||
end
|
assert_equal("rejected", @bulk_update_request.status)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -64,9 +64,9 @@ class BulkUpdateRequestsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
context "for an admin" do
|
context "for an admin" do
|
||||||
should "succeed" do
|
should "succeed" do
|
||||||
assert_difference("BulkUpdateRequest.count", -1) do
|
delete :destroy, {:id => @bulk_update_request.id}, {:user_id => @admin.id}
|
||||||
delete :destroy, {:id => @bulk_update_request.id}, {:user_id => @admin.id}
|
@bulk_update_request.reload
|
||||||
end
|
assert_equal("rejected", @bulk_update_request.status)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,14 +72,6 @@ class TagAliasesControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "create action" do
|
|
||||||
should "create a tag alias" do
|
|
||||||
assert_difference("TagAlias.count", 1) do
|
|
||||||
post :create, {:tag_alias => {:antecedent_name => "xxx", :consequent_name => "yyy"}}, {:user_id => @user.id}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "destroy action" do
|
context "destroy action" do
|
||||||
setup do
|
setup do
|
||||||
@tag_alias = FactoryGirl.create(:tag_alias)
|
@tag_alias = FactoryGirl.create(:tag_alias)
|
||||||
|
|||||||
@@ -75,14 +75,6 @@ class TagImplicationsControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "create action" do
|
|
||||||
should "create a tag implication" do
|
|
||||||
assert_difference("TagImplication.count", 1) do
|
|
||||||
post :create, {:tag_implication => {:antecedent_name => "xxx", :consequent_name => "yyy"}}, {:user_id => @user.id}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "destroy action" do
|
context "destroy action" do
|
||||||
setup do
|
setup do
|
||||||
CurrentUser.scoped(@user, "127.0.0.1") do
|
CurrentUser.scoped(@user, "127.0.0.1") do
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ module Downloads
|
|||||||
@source = "http://mochikko.deviantart.com/art/RESOLUTION-339610451"
|
@source = "http://mochikko.deviantart.com/art/RESOLUTION-339610451"
|
||||||
@tempfile = Tempfile.new("danbooru-test")
|
@tempfile = Tempfile.new("danbooru-test")
|
||||||
@download = Downloads::File.new(@source, @tempfile.path)
|
@download = Downloads::File.new(@source, @tempfile.path)
|
||||||
VCR.use_cassette("download-deviant-art-html", :record => :new_episodes) do
|
VCR.use_cassette("download-deviant-art-html", :record => :none) do
|
||||||
@download.download!
|
@download.download!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
should "set the direct image link as the source" do
|
should "set the direct image link as the source" do
|
||||||
assert_equal("http://www.deviantart.com/download/339610451/resolution_by_mochikko-d5m713n.jpg?token=f828643e6e86a658e80f362745a0b20e20880fc6&ts=1414021578", @download.source)
|
assert_equal("http://fc03.deviantart.net/fs71/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "work" do
|
should "work" do
|
||||||
|
|||||||
@@ -231,8 +231,8 @@ module Downloads
|
|||||||
should "download the full size image instead of the thumbnail" do
|
should "download the full size image instead of the thumbnail" do
|
||||||
assert_rewritten(@p0_full_size_image_3, @p0_large_thumbnail, "rewrite-pixiv-new-manga-p0-large-thumbnail")
|
assert_rewritten(@p0_full_size_image_3, @p0_large_thumbnail, "rewrite-pixiv-new-manga-p0-large-thumbnail")
|
||||||
assert_rewritten(@p1_full_size_image_3, @p1_large_thumbnail, "rewrite-pixiv-new-manga-p1-large-thumbnail")
|
assert_rewritten(@p1_full_size_image_3, @p1_large_thumbnail, "rewrite-pixiv-new-manga-p1-large-thumbnail")
|
||||||
assert_downloaded(@p0_file_size, @p0_large_thumbnail, "download-pixiv-new-manga-p0-large-thumbnail", :all)
|
assert_downloaded(@p0_file_size, @p0_large_thumbnail, "download-pixiv-new-manga-p0-large-thumbnail")
|
||||||
assert_downloaded(@p1_file_size, @p1_large_thumbnail, "download-pixiv-new-manga-p1-large-thumbnail", :all)
|
assert_downloaded(@p1_file_size, @p1_large_thumbnail, "download-pixiv-new-manga-p1-large-thumbnail")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class PoolTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
should "update any new posts that were added" do
|
should "update any new posts that were added" do
|
||||||
@p1.reload
|
@p1.reload
|
||||||
assert_equal("pool:#{@pool.id}", @p1.pool_string)
|
assert_equal("pool:#{@pool.id} pool:series", @p1.pool_string)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -255,13 +255,14 @@ class UploadTest < ActiveSupport::TestCase
|
|||||||
VCR.use_cassette("ugoira-converter", :record => :none) do
|
VCR.use_cassette("ugoira-converter", :record => :none) do
|
||||||
assert_difference(["Post.count", "PixivUgoiraFrameData.count"]) do
|
assert_difference(["Post.count", "PixivUgoiraFrameData.count"]) do
|
||||||
@upload.process!
|
@upload.process!
|
||||||
|
assert_equal([], @upload.errors.full_messages)
|
||||||
end
|
end
|
||||||
post = Post.last
|
post = Post.last
|
||||||
assert_not_nil(post.pixiv_ugoira_frame_data)
|
assert_not_nil(post.pixiv_ugoira_frame_data)
|
||||||
assert_equal("0d94800c4b520bf3d8adda08f95d31e2", post.md5)
|
assert_equal("0d94800c4b520bf3d8adda08f95d31e2", post.md5)
|
||||||
assert_equal(60, post.image_width)
|
assert_equal(60, post.image_width)
|
||||||
assert_equal(60, post.image_height)
|
assert_equal(60, post.image_height)
|
||||||
assert_equal("http://i1.pixiv.net/img-zip-ugoira/img/2014/10/05/23/42/23/46378654_ugoira1920x1080.zip", post.source)
|
assert_equal("http://i3.pixiv.net/img-zip-ugoira/img/2014/10/05/23/42/23/46378654_ugoira1920x1080.zip", post.source)
|
||||||
assert_operator(File.size(post.large_file_path), :>, 0)
|
assert_operator(File.size(post.large_file_path), :>, 0)
|
||||||
assert_operator(File.size(post.preview_file_path), :>, 0)
|
assert_operator(File.size(post.preview_file_path), :>, 0)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user