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.ip_addr = "127.0.0.1"
MEMCACHE.flush_all
Delayed::Worker.delay_jobs = false
@tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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