fixes #2432, fix tests

This commit is contained in:
r888888888
2015-07-14 15:13:04 -07:00
parent 2c8cacd50e
commit 6ad6aa44c4
13 changed files with 6809 additions and 841 deletions

View File

@@ -7,13 +7,13 @@ module Downloads
@source = "http://mochikko.deviantart.com/art/RESOLUTION-339610451"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
VCR.use_cassette("download-deviant-art-html", :record => :none) do
VCR.use_cassette("download-deviant-art-html", :record => :once) do
@download.download!
end
end
should "set the direct image link as the source" do
assert_equal("http://fc03.deviantart.net/fs71/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
should "set the html page as the source" do
assert_equal("http://orig02.deviantart.net/a45d/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
end
should "work" do
@@ -26,13 +26,13 @@ module Downloads
@source = "http://fc03.deviantart.net/fs71/200H/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
VCR.use_cassette("download-deviant-art-thumb", :record => :none) do
VCR.use_cassette("download-deviant-art-thumb", :record => :once) do
@download.download!
end
end
should "instead download the original version" do
assert_equal("http://fc03.deviantart.net/fs71/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
assert_equal("http://orig02.deviantart.net/a45d/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
end
should "work" do

View File

@@ -109,18 +109,6 @@ class ForumPostTest < ActiveSupport::TestCase
assert_equal(@user.id, post.creator_id)
end
context "that is deleted" do
setup do
@post = FactoryGirl.create(:forum_post, :topic_id => @topic.id)
@post.delete!
@topic.reload
end
should "also delete the topic" do
assert(@topic.is_deleted)
end
end
context "updated by a second user" do
setup do
@post = FactoryGirl.create(:forum_post, :topic_id => @topic.id)

View File

@@ -1463,6 +1463,7 @@ class PostTest < ActiveSupport::TestCase
context "The cache" do
context "when shared between users on danbooru/safebooru" do
setup do
Danbooru.config.stubs(:blank_tag_search_fast_count).returns(nil)
FactoryGirl.create(:post, :tag_string => "aaa bbb", :rating => "q")
FactoryGirl.create(:post, :tag_string => "aaa bbb", :rating => "s")
FactoryGirl.create(:post, :tag_string => "aaa bbb", :rating => "s")