2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-31 14:05:14 +00:00

Always clear cache before every tests.

This commit is contained in:
edogawaconan
2014-12-06 01:05:47 +09:00
parent 2d6da991fe
commit 9faa5577ec
17 changed files with 5 additions and 45 deletions

View File

@@ -2,8 +2,6 @@ require "test_helper"
class UserMailerTest < ActionMailer::TestCase
def setup
Rails.cache.clear
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []

View File

@@ -3,10 +3,6 @@ require "test_helper"
class ArtistTest < ActiveSupport::TestCase
fixtures :users
def setup
Rails.cache.clear
end
def create_artist(params)
Artist.create({ :updater_id => 1, :updater_ip_addr => "127.0.0.1" }.merge(params))
end

View File

@@ -3,10 +3,6 @@ require "test_helper"
class ArtistUrlTest < ActiveSupport::TestCase
fixtures :users, :artists
def setup
Rails.cache.clear
end
def test_normalize
artist = Artist.create(:name => "yukie")
url = ArtistUrl.create(:artist_id => artist.id, :url => nil)

View File

@@ -4,8 +4,6 @@ class BanTest < ActiveSupport::TestCase
fixtures :users
def setup
Rails.cache.clear
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []

View File

@@ -3,10 +3,6 @@ require "test_helper"
class CommentTest < ActiveSupport::TestCase
fixtures :users, :posts
def setup
Rails.cache.clear
end
def test_simple
comment = Comment.create(:post_id => 1, :user_id => 1, :body => "hello world", :ip_addr => "127.0.0.1")
assert_equal("admin", comment.author)

View File

@@ -5,8 +5,6 @@ class DmailTest < ActiveSupport::TestCase
fixtures :users
def setup
Rails.cache.clear
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []

View File

@@ -3,10 +3,6 @@ require "test_helper"
class ForumPostTest < ActiveSupport::TestCase
fixtures :users
def setup
Rails.cache.clear
end
def create_post(msg, parent_id = nil, params = {})
ForumPost.create({ :creator_id => 1, :body => msg, :title => msg, :is_sticky => false, :is_locked => false, :parent_id => parent_id }.merge(params))
end

View File

@@ -4,7 +4,6 @@ class NoteTest < ActiveSupport::TestCase
fixtures :users, :posts
def setup
Rails.cache.clear
Thread.current[:versioning_history] = nil
end

View File

@@ -3,10 +3,6 @@ require "test_helper"
class PoolTest < ActiveSupport::TestCase
fixtures :users, :posts
def setup
Rails.cache.clear
end
def create_pool(params = {})
Pool.create({ :user_id => 1, :name => "my pool", :post_count => 0, :is_public => false, :description => "pools" }.merge(params))
end

View File

@@ -4,8 +4,6 @@ class PostTagHistoryTest < ActiveSupport::TestCase
fixtures :users
def setup
Rails.cache.clear
@test_number = 1
end

View File

@@ -4,8 +4,6 @@ class PostTest < ActiveSupport::TestCase
# fixtures :users, :posts, :table_data
def setup
Rails.cache.clear
# TODO: revert these after testing in teardown
CONFIG["image_samples"] = true
CONFIG["sample_width"] = 100

View File

@@ -2,8 +2,6 @@ require "test_helper"
class TagAliasTest < ActiveSupport::TestCase
def setup
Rails.cache.clear
@alias = TagAlias.create(:name => "tag2", :alias => "tag1", :is_pending => false, :reason => "none", :creator_id => 1)
@test_number = 1
end

View File

@@ -2,8 +2,6 @@ require "test_helper"
class TagTest < ActiveSupport::TestCase
def setup
Rails.cache.clear
@test_number = 1
end

View File

@@ -1,10 +1,6 @@
require "test_helper"
class UserRecordTest < ActiveSupport::TestCase
def setup
Rails.cache.clear
end
def create_user(name, params = {})
user = User.new({ :password => "zugzug1", :password_confirmation => "zugzug1", :email => "#{name}@danbooru.com" }.merge(params))
user.name = name

View File

@@ -4,8 +4,6 @@ class UserTest < ActiveSupport::TestCase
fixtures :users
def setup
Rails.cache.clear
@post_number = 1
end

View File

@@ -1,10 +1,6 @@
require "test_helper"
class WikiPageTest < ActiveSupport::TestCase
def setup
Rails.cache.clear
end
def create_wiki(params = {})
WikiPage.create({ :title => "hoge", :user_id => 1, :body => "hoge", :ip_addr => "127.0.0.1", :is_locked => false }.merge(params))
end

View File

@@ -16,10 +16,15 @@ class ActiveSupport::TestCase
t
end
setup :clear_cache
setup :reset_thread_variables
private
def clear_cache
Rails.cache.clear
end
def reset_thread_variables
%w(danbooru-user danbooru-user_id).each do |x|
Thread.current[x] = nil