tests: set Delayed::Worker.delay_jobs = false globally.

This commit is contained in:
evazion
2017-02-03 17:24:10 -06:00
parent 98b0b2c5d8
commit beddc34958
21 changed files with 4 additions and 32 deletions

View File

@@ -7,7 +7,6 @@ class TagAliasCorrectionsControllerTest < ActionController::TestCase
CurrentUser.user = @admin CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
@tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb") @tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
end end

View File

@@ -7,7 +7,6 @@ class TagAliasRequestsControllerTest < ActionController::TestCase
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -7,7 +7,6 @@ class TagAliasesControllerTest < ActionController::TestCase
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -9,7 +9,6 @@ class TagImplicationRequestsControllerTest < ActionController::TestCase
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -7,7 +7,6 @@ class TagImplicationsControllerTest < ActionController::TestCase
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -105,3 +105,4 @@ if defined?(MEMCACHE)
end end
MEMCACHE = MockMemcache.new MEMCACHE = MockMemcache.new
Delayed::Worker.delay_jobs = false

View File

@@ -3,7 +3,6 @@ require 'test_helper'
class AliasAndImplicationImporterTest < ActiveSupport::TestCase class AliasAndImplicationImporterTest < ActiveSupport::TestCase
context "The alias and implication importer" do context "The alias and implication importer" do
setup do setup do
Delayed::Worker.delay_jobs = true
CurrentUser.user = FactoryGirl.create(:admin_user) CurrentUser.user = FactoryGirl.create(:admin_user)
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
end end
@@ -20,9 +19,9 @@ class AliasAndImplicationImporterTest < ActiveSupport::TestCase
end end
should "process it" do should "process it" do
assert_difference("Delayed::Job.count", 2) do @importer.process!
@importer.process! assert(TagAlias.exists?(antecedent_name: "abc", consequent_name: "def"))
end assert(TagImplication.exists?(antecedent_name: "aaa", consequent_name: "bbb"))
end end
end end

View File

@@ -19,7 +19,6 @@ class ArtistTest < ActiveSupport::TestCase
CurrentUser.user = user CurrentUser.user = user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -6,7 +6,6 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
@admin = FactoryGirl.create(:admin_user) @admin = FactoryGirl.create(:admin_user)
CurrentUser.user = @admin CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -27,7 +27,6 @@ module Downloads
context "An ugoira site for pixiv" do context "An ugoira site for pixiv" do
setup do setup do
Delayed::Worker.delay_jobs = false
@tempfile = Tempfile.new("danbooru-test") @tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=46378654", @tempfile.path) @download = Downloads::File.new("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=46378654", @tempfile.path)
@download.download! @download.download!

View File

@@ -13,7 +13,6 @@ class PostTest < ActiveSupport::TestCase
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
mock_saved_search_service! mock_saved_search_service!
end end
@@ -520,7 +519,6 @@ class PostTest < ActiveSupport::TestCase
context "with an artist tag that is then changed to copyright" do context "with an artist tag that is then changed to copyright" do
setup do setup do
CurrentUser.user = FactoryGirl.create(:builder_user) CurrentUser.user = FactoryGirl.create(:builder_user)
Delayed::Worker.delay_jobs = false
@post = Post.find(@post.id) @post = Post.find(@post.id)
@post.update(:tag_string => "art:abc") @post.update(:tag_string => "art:abc")
@post = Post.find(@post.id) @post = Post.find(@post.id)
@@ -528,10 +526,6 @@ class PostTest < ActiveSupport::TestCase
@post.reload @post.reload
end end
teardown do
Delayed::Worker.delay_jobs = true
end
should "update the category of the tag" do should "update the category of the tag" do
assert_equal(Tag.categories.copyright, Tag.find_by_name("abc").category) assert_equal(Tag.categories.copyright, Tag.find_by_name("abc").category)
end end

View File

@@ -6,7 +6,6 @@ class RelatedTagQueryTest < ActiveSupport::TestCase
CurrentUser.user = user CurrentUser.user = user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
context "a related tag query without a category constraint" do context "a related tag query without a category constraint" do

View File

@@ -7,7 +7,6 @@ class TagAliasCorrectionTest < ActiveSupport::TestCase
CurrentUser.user = @mod CurrentUser.user = @mod
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
@post = FactoryGirl.create(:post, :tag_string => "aaa") @post = FactoryGirl.create(:post, :tag_string => "aaa")
@tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb") @tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
end end

View File

@@ -7,7 +7,6 @@ class TagAliasRequestTest < ActiveSupport::TestCase
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -12,7 +12,6 @@ class TagAliasTest < ActiveSupport::TestCase
end end
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
mock_saved_search_service! mock_saved_search_service!
end end

View File

@@ -7,7 +7,6 @@ class TagImplicationRequestTest < ActiveSupport::TestCase
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -8,7 +8,6 @@ class TagImplicationTest < ActiveSupport::TestCase
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
@user = FactoryGirl.create(:user) @user = FactoryGirl.create(:user)
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -5,7 +5,6 @@ class TagSubscriptionTest < ActiveSupport::TestCase
user = FactoryGirl.create(:user) user = FactoryGirl.create(:user)
CurrentUser.user = user CurrentUser.user = user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
Delayed::Worker.delay_jobs = false
MEMCACHE.flush_all MEMCACHE.flush_all
end end

View File

@@ -6,7 +6,6 @@ class TagTest < ActiveSupport::TestCase
CurrentUser.user = user CurrentUser.user = user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do

View File

@@ -16,13 +16,11 @@ class UploadTest < ActiveSupport::TestCase
CurrentUser.user = user CurrentUser.user = user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
end end
teardown do teardown do
CurrentUser.user = nil CurrentUser.user = nil
CurrentUser.ip_addr = nil CurrentUser.ip_addr = nil
Delayed::Worker.delay_jobs = true
@upload.delete_temp_file if @upload @upload.delete_temp_file if @upload
end end

View File

@@ -4,7 +4,6 @@ class UserDeletionTest < ActiveSupport::TestCase
context "an invalid user deletion" do context "an invalid user deletion" do
context "for an invalid password" do context "for an invalid password" do
setup do setup do
Delayed::Worker.delay_jobs = false
@user = FactoryGirl.create(:user) @user = FactoryGirl.create(:user)
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
@@ -20,7 +19,6 @@ class UserDeletionTest < ActiveSupport::TestCase
context "for an admin" do context "for an admin" do
setup do setup do
Delayed::Worker.delay_jobs = false
@user = FactoryGirl.create(:admin_user) @user = FactoryGirl.create(:admin_user)
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"
@@ -37,8 +35,6 @@ class UserDeletionTest < ActiveSupport::TestCase
context "a valid user deletion" do context "a valid user deletion" do
setup do setup do
Delayed::Worker.delay_jobs = false
@user = FactoryGirl.create(:user) @user = FactoryGirl.create(:user)
CurrentUser.user = @user CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1" CurrentUser.ip_addr = "127.0.0.1"