From c0e5c400a714e41d8500af4c7d1a34da158965d7 Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 15 Apr 2017 21:51:56 -0500 Subject: [PATCH] tests: fix tests for Rails.cache. --- app/logical/cache.rb | 4 ++++ .../moderator/invitations_controller_test.rb | 1 - .../moderator/ip_addrs_controller_test.rb | 1 - test/functional/posts_controller_test.rb | 1 - .../tag_alias_corrections_controller_test.rb | 1 - .../tag_alias_requests_controller_test.rb | 1 - test/functional/tag_aliases_controller_test.rb | 1 - .../tag_implication_requests_controller_test.rb | 1 - .../tag_implications_controller_test.rb | 1 - test/test_helper.rb | 13 ++++++++----- test/unit/artist_test.rb | 1 - test/unit/artist_url_test.rb | 1 - test/unit/comment_test.rb | 1 - test/unit/dmail_test.rb | 1 - test/unit/favorite_test.rb | 1 - test/unit/ip_ban_test.rb | 1 - test/unit/janitor_trial_test.rb | 1 - test/unit/moderator/ip_addr_search_test.rb | 1 - test/unit/note_test.rb | 1 - test/unit/pool_test.rb | 1 - test/unit/post_appeal_test.rb | 1 - test/unit/post_archive_test.rb | 1 - test/unit/post_disapproval_test.rb | 1 - test/unit/post_flag_test.rb | 1 - test/unit/post_pruner_test.rb | 1 - test/unit/post_sets/favorite_test.rb | 1 - test/unit/post_sets/intro_test.rb | 1 - test/unit/post_sets/pool_test.rb | 1 - test/unit/post_sets/post_test.rb | 1 - test/unit/post_test.rb | 1 - test/unit/post_version_test.rb | 1 - test/unit/post_vote_test.rb | 1 - test/unit/related_tag_calculator_test.rb | 1 - test/unit/related_tag_query_test.rb | 1 - test/unit/saved_search_test.rb | 4 ---- test/unit/tag_alias_correction_test.rb | 2 -- test/unit/tag_alias_request_test.rb | 2 -- test/unit/tag_alias_test.rb | 1 - test/unit/tag_implication_request_test.rb | 2 -- test/unit/tag_implication_test.rb | 1 - test/unit/tag_subscription_test.rb | 1 - test/unit/tag_test.rb | 17 ++--------------- test/unit/upload_test.rb | 1 - test/unit/user_feedback_test.rb | 1 - test/unit/user_test.rb | 1 - test/unit/wiki_page_test.rb | 1 - 46 files changed, 14 insertions(+), 69 deletions(-) diff --git a/app/logical/cache.rb b/app/logical/cache.rb index be11a3eca..68a29f2e0 100644 --- a/app/logical/cache.rb +++ b/app/logical/cache.rb @@ -37,6 +37,10 @@ class Cache nil end + def self.clear + Rails.cache.clear + end + def self.sanitize(key) key.gsub(/\W/) {|x| "%#{x.ord}"}.slice(0, 230) end diff --git a/test/functional/moderator/invitations_controller_test.rb b/test/functional/moderator/invitations_controller_test.rb index 1da3981ef..994e83190 100644 --- a/test/functional/moderator/invitations_controller_test.rb +++ b/test/functional/moderator/invitations_controller_test.rb @@ -7,7 +7,6 @@ module Moderator @mod = FactoryGirl.create(:moderator_user) CurrentUser.user = @mod CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all @user_1 = FactoryGirl.create(:user) @user_2 = FactoryGirl.create(:user, :inviter_id => @mod.id) diff --git a/test/functional/moderator/ip_addrs_controller_test.rb b/test/functional/moderator/ip_addrs_controller_test.rb index 9ee5ba2a6..eeaf97977 100644 --- a/test/functional/moderator/ip_addrs_controller_test.rb +++ b/test/functional/moderator/ip_addrs_controller_test.rb @@ -8,7 +8,6 @@ module Moderator CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" FactoryGirl.create(:comment) - MEMCACHE.flush_all end should "find by ip addr" do diff --git a/test/functional/posts_controller_test.rb b/test/functional/posts_controller_test.rb index d78111855..749c88367 100644 --- a/test/functional/posts_controller_test.rb +++ b/test/functional/posts_controller_test.rb @@ -8,7 +8,6 @@ class PostsControllerTest < ActionController::TestCase CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" @post = FactoryGirl.create(:post, :uploader_id => @user.id, :tag_string => "aaaa") - MEMCACHE.flush_all end teardown do diff --git a/test/functional/tag_alias_corrections_controller_test.rb b/test/functional/tag_alias_corrections_controller_test.rb index 344653ed4..ffd21bcdf 100644 --- a/test/functional/tag_alias_corrections_controller_test.rb +++ b/test/functional/tag_alias_corrections_controller_test.rb @@ -6,7 +6,6 @@ class TagAliasCorrectionsControllerTest < ActionController::TestCase @admin = FactoryGirl.create(:admin_user) CurrentUser.user = @admin CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all @tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb") end diff --git a/test/functional/tag_alias_requests_controller_test.rb b/test/functional/tag_alias_requests_controller_test.rb index 092dee541..c37f116dd 100644 --- a/test/functional/tag_alias_requests_controller_test.rb +++ b/test/functional/tag_alias_requests_controller_test.rb @@ -6,7 +6,6 @@ class TagAliasRequestsControllerTest < ActionController::TestCase @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/functional/tag_aliases_controller_test.rb b/test/functional/tag_aliases_controller_test.rb index 83a4ed261..331da445b 100644 --- a/test/functional/tag_aliases_controller_test.rb +++ b/test/functional/tag_aliases_controller_test.rb @@ -6,7 +6,6 @@ class TagAliasesControllerTest < ActionController::TestCase @user = FactoryGirl.create(:admin_user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/functional/tag_implication_requests_controller_test.rb b/test/functional/tag_implication_requests_controller_test.rb index 456187dc6..4bc8613d6 100644 --- a/test/functional/tag_implication_requests_controller_test.rb +++ b/test/functional/tag_implication_requests_controller_test.rb @@ -8,7 +8,6 @@ class TagImplicationRequestsControllerTest < ActionController::TestCase end CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/functional/tag_implications_controller_test.rb b/test/functional/tag_implications_controller_test.rb index 7c3bc58b7..2d9377ae8 100644 --- a/test/functional/tag_implications_controller_test.rb +++ b/test/functional/tag_implications_controller_test.rb @@ -6,7 +6,6 @@ class TagImplicationsControllerTest < ActionController::TestCase @user = FactoryGirl.create(:admin_user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/test_helper.rb b/test/test_helper.rb index b71c9bbb3..dbe64b14a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -21,12 +21,12 @@ Shoulda::Matchers.configure do |config| end end -if defined?(MEMCACHE) - Object.send(:remove_const, :MEMCACHE) -end - class ActiveSupport::TestCase include PostArchiveTestHelper + + teardown do + Cache.clear + end end class ActionController::TestCase @@ -41,9 +41,12 @@ class ActionController::TestCase __send__(http_method, action, params, session.merge(:user_id => @users[role].id)) assert_redirected_to(new_sessions_path) end + + teardown do + Cache.clear + end end -MEMCACHE = MemcacheMock.new Delayed::Worker.delay_jobs = false require "helpers/reportbooru_helper" diff --git a/test/unit/artist_test.rb b/test/unit/artist_test.rb index cc062c0b8..9a58efce7 100644 --- a/test/unit/artist_test.rb +++ b/test/unit/artist_test.rb @@ -18,7 +18,6 @@ class ArtistTest < ActiveSupport::TestCase user = Timecop.travel(1.month.ago) {FactoryGirl.create(:user)} CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/artist_url_test.rb b/test/unit/artist_url_test.rb index 28df08da1..1607c5734 100644 --- a/test/unit/artist_url_test.rb +++ b/test/unit/artist_url_test.rb @@ -3,7 +3,6 @@ require 'test_helper' class ArtistUrlTest < ActiveSupport::TestCase context "An artist url" do setup do - MEMCACHE.flush_all CurrentUser.user = FactoryGirl.create(:user) CurrentUser.ip_addr = "127.0.0.1" end diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 5aa3a105f..14af13400 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -6,7 +6,6 @@ class CommentTest < ActiveSupport::TestCase user = FactoryGirl.create(:user) CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/dmail_test.rb b/test/unit/dmail_test.rb index 1b775cc81..4a6d6343f 100644 --- a/test/unit/dmail_test.rb +++ b/test/unit/dmail_test.rb @@ -3,7 +3,6 @@ require 'test_helper' class DmailTest < ActiveSupport::TestCase context "A dmail" do setup do - MEMCACHE.flush_all @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "1.2.3.4" diff --git a/test/unit/favorite_test.rb b/test/unit/favorite_test.rb index 371d5c5c9..58900305e 100644 --- a/test/unit/favorite_test.rb +++ b/test/unit/favorite_test.rb @@ -5,7 +5,6 @@ class FavoriteTest < ActiveSupport::TestCase user = FactoryGirl.create(:user) CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all Favorite # need to force loading the favorite model end diff --git a/test/unit/ip_ban_test.rb b/test/unit/ip_ban_test.rb index 8188f1c40..1e8ebc4ed 100644 --- a/test/unit/ip_ban_test.rb +++ b/test/unit/ip_ban_test.rb @@ -5,7 +5,6 @@ class IpBanTest < ActiveSupport::TestCase @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now) end diff --git a/test/unit/janitor_trial_test.rb b/test/unit/janitor_trial_test.rb index 282fc56d1..e91ff867c 100644 --- a/test/unit/janitor_trial_test.rb +++ b/test/unit/janitor_trial_test.rb @@ -7,7 +7,6 @@ class JanitorTrialTest < ActiveSupport::TestCase @user = FactoryGirl.create(:user) CurrentUser.user = @admin CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/moderator/ip_addr_search_test.rb b/test/unit/moderator/ip_addr_search_test.rb index 9b9bf82aa..d69cdfc14 100644 --- a/test/unit/moderator/ip_addr_search_test.rb +++ b/test/unit/moderator/ip_addr_search_test.rb @@ -9,7 +9,6 @@ module Moderator CurrentUser.ip_addr = "127.0.0.1" Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now) FactoryGirl.create(:comment) - MEMCACHE.flush_all end teardown do diff --git a/test/unit/note_test.rb b/test/unit/note_test.rb index 081f46fbd..b4c597718 100644 --- a/test/unit/note_test.rb +++ b/test/unit/note_test.rb @@ -6,7 +6,6 @@ class NoteTest < ActiveSupport::TestCase @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/pool_test.rb b/test/unit/pool_test.rb index abf91bad2..e2aca70a0 100644 --- a/test/unit/pool_test.rb +++ b/test/unit/pool_test.rb @@ -13,7 +13,6 @@ class PoolTest < ActiveSupport::TestCase end CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all mock_pool_archive_service! PoolArchive.sqs_service.stubs(:merge?).returns(false) diff --git a/test/unit/post_appeal_test.rb b/test/unit/post_appeal_test.rb index bc44b4324..e2322d50e 100644 --- a/test/unit/post_appeal_test.rb +++ b/test/unit/post_appeal_test.rb @@ -6,7 +6,6 @@ class PostAppealTest < ActiveSupport::TestCase @alice = FactoryGirl.create(:user) CurrentUser.user = @alice CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all Danbooru.config.stubs(:max_appeals_per_day).returns(5) end diff --git a/test/unit/post_archive_test.rb b/test/unit/post_archive_test.rb index 56fec25ad..0cd82dd3a 100644 --- a/test/unit/post_archive_test.rb +++ b/test/unit/post_archive_test.rb @@ -8,7 +8,6 @@ class PostArchiveTest < ActiveSupport::TestCase end CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/post_disapproval_test.rb b/test/unit/post_disapproval_test.rb index 33331e31a..0edf07133 100644 --- a/test/unit/post_disapproval_test.rb +++ b/test/unit/post_disapproval_test.rb @@ -6,7 +6,6 @@ class PostDisapprovalTest < ActiveSupport::TestCase @alice = FactoryGirl.create(:moderator_user) CurrentUser.user = @alice CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/post_flag_test.rb b/test/unit/post_flag_test.rb index 9e4afa602..2e11ee37c 100644 --- a/test/unit/post_flag_test.rb +++ b/test/unit/post_flag_test.rb @@ -8,7 +8,6 @@ class PostFlagTest < ActiveSupport::TestCase end CurrentUser.user = @alice CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all @post = FactoryGirl.create(:post, :tag_string => "aaa") end diff --git a/test/unit/post_pruner_test.rb b/test/unit/post_pruner_test.rb index 5f8a7b76c..b2a7e68c6 100644 --- a/test/unit/post_pruner_test.rb +++ b/test/unit/post_pruner_test.rb @@ -5,7 +5,6 @@ class PostPrunerTest < ActiveSupport::TestCase @user = FactoryGirl.create(:admin_user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all Timecop.travel(2.weeks.ago) do @flagger = FactoryGirl.create(:gold_user) diff --git a/test/unit/post_sets/favorite_test.rb b/test/unit/post_sets/favorite_test.rb index 3aac726b1..ef06e39a4 100644 --- a/test/unit/post_sets/favorite_test.rb +++ b/test/unit/post_sets/favorite_test.rb @@ -7,7 +7,6 @@ module PostSets @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all @post_1 = FactoryGirl.create(:post) @post_2 = FactoryGirl.create(:post) diff --git a/test/unit/post_sets/intro_test.rb b/test/unit/post_sets/intro_test.rb index 58a19363c..00b3eb66e 100644 --- a/test/unit/post_sets/intro_test.rb +++ b/test/unit/post_sets/intro_test.rb @@ -8,7 +8,6 @@ module PostSets @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all @post_1 = FactoryGirl.create(:post, :tag_string => "a") @post_2 = FactoryGirl.create(:post, :tag_string => "b") diff --git a/test/unit/post_sets/pool_test.rb b/test/unit/post_sets/pool_test.rb index 69d15a52e..bf48c8921 100644 --- a/test/unit/post_sets/pool_test.rb +++ b/test/unit/post_sets/pool_test.rb @@ -10,7 +10,6 @@ module PostSets @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all mock_pool_archive_service! start_pool_archive_transaction diff --git a/test/unit/post_sets/post_test.rb b/test/unit/post_sets/post_test.rb index 661765f31..d9bb9abf6 100644 --- a/test/unit/post_sets/post_test.rb +++ b/test/unit/post_sets/post_test.rb @@ -8,7 +8,6 @@ module PostSets @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all @post_1 = FactoryGirl.create(:post, :tag_string => "a") @post_2 = FactoryGirl.create(:post, :tag_string => "b") diff --git a/test/unit/post_test.rb b/test/unit/post_test.rb index a4d29877d..7eb9d92a6 100644 --- a/test/unit/post_test.rb +++ b/test/unit/post_test.rb @@ -18,7 +18,6 @@ class PostTest < ActiveSupport::TestCase end CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all mock_saved_search_service! end diff --git a/test/unit/post_version_test.rb b/test/unit/post_version_test.rb index 71cb31c6c..597f10d6f 100644 --- a/test/unit/post_version_test.rb +++ b/test/unit/post_version_test.rb @@ -8,7 +8,6 @@ class PostVersionTest < ActiveSupport::TestCase end CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/post_vote_test.rb b/test/unit/post_vote_test.rb index 1280c77d9..01e4968d1 100644 --- a/test/unit/post_vote_test.rb +++ b/test/unit/post_vote_test.rb @@ -8,7 +8,6 @@ class PostVoteTest < ActiveSupport::TestCase @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all @post = FactoryGirl.create(:post) end diff --git a/test/unit/related_tag_calculator_test.rb b/test/unit/related_tag_calculator_test.rb index 471b12d7f..bfa28ad51 100644 --- a/test/unit/related_tag_calculator_test.rb +++ b/test/unit/related_tag_calculator_test.rb @@ -5,7 +5,6 @@ class RelatedTagCalculatorTest < ActiveSupport::TestCase user = FactoryGirl.create(:user) CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/related_tag_query_test.rb b/test/unit/related_tag_query_test.rb index 01507098d..2286aad41 100644 --- a/test/unit/related_tag_query_test.rb +++ b/test/unit/related_tag_query_test.rb @@ -5,7 +5,6 @@ class RelatedTagQueryTest < ActiveSupport::TestCase user = FactoryGirl.create(:user) CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end context "a related tag query without a category constraint" do diff --git a/test/unit/saved_search_test.rb b/test/unit/saved_search_test.rb index 6bb38a8e1..d1c57700a 100644 --- a/test/unit/saved_search_test.rb +++ b/test/unit/saved_search_test.rb @@ -41,10 +41,6 @@ class SavedSearchTest < ActiveSupport::TestCase end context "Fetching the post ids for a search" do - setup do - MEMCACHE.expects(:get).returns(nil) - end - teardown do FakeWeb.clean_registry end diff --git a/test/unit/tag_alias_correction_test.rb b/test/unit/tag_alias_correction_test.rb index c9e48575d..b79760b69 100644 --- a/test/unit/tag_alias_correction_test.rb +++ b/test/unit/tag_alias_correction_test.rb @@ -6,13 +6,11 @@ class TagAliasCorrectionTest < ActiveSupport::TestCase @mod = FactoryGirl.create(:moderator_user) CurrentUser.user = @mod CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all @post = FactoryGirl.create(:post, :tag_string => "aaa") @tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb") end teardown do - MEMCACHE.flush_all CurrentUser.user = nil CurrentUser.ip_addr = nil end diff --git a/test/unit/tag_alias_request_test.rb b/test/unit/tag_alias_request_test.rb index 15aa68196..7d140b04a 100644 --- a/test/unit/tag_alias_request_test.rb +++ b/test/unit/tag_alias_request_test.rb @@ -6,11 +6,9 @@ class TagAliasRequestTest < ActiveSupport::TestCase @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do - MEMCACHE.flush_all CurrentUser.user = nil CurrentUser.ip_addr = nil end diff --git a/test/unit/tag_alias_test.rb b/test/unit/tag_alias_test.rb index 6592b4709..2333cdfe1 100644 --- a/test/unit/tag_alias_test.rb +++ b/test/unit/tag_alias_test.rb @@ -11,7 +11,6 @@ class TagAliasTest < ActiveSupport::TestCase CurrentUser.user = user end CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all mock_saved_search_service! end diff --git a/test/unit/tag_implication_request_test.rb b/test/unit/tag_implication_request_test.rb index a9047aee7..2d09a182d 100644 --- a/test/unit/tag_implication_request_test.rb +++ b/test/unit/tag_implication_request_test.rb @@ -6,11 +6,9 @@ class TagImplicationRequestTest < ActiveSupport::TestCase @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do - MEMCACHE.flush_all CurrentUser.user = nil CurrentUser.ip_addr = nil end diff --git a/test/unit/tag_implication_test.rb b/test/unit/tag_implication_test.rb index d1c32b366..5ac1a5ef9 100644 --- a/test/unit/tag_implication_test.rb +++ b/test/unit/tag_implication_test.rb @@ -7,7 +7,6 @@ class TagImplicationTest < ActiveSupport::TestCase CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" @user = FactoryGirl.create(:user) - MEMCACHE.flush_all end teardown do diff --git a/test/unit/tag_subscription_test.rb b/test/unit/tag_subscription_test.rb index 4da3d6416..9ecc4cabd 100644 --- a/test/unit/tag_subscription_test.rb +++ b/test/unit/tag_subscription_test.rb @@ -5,7 +5,6 @@ class TagSubscriptionTest < ActiveSupport::TestCase user = FactoryGirl.create(:user) CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/tag_test.rb b/test/unit/tag_test.rb index 3ba6086d1..c1185abba 100644 --- a/test/unit/tag_test.rb +++ b/test/unit/tag_test.rb @@ -5,7 +5,6 @@ class TagTest < ActiveSupport::TestCase user = FactoryGirl.create(:builder_user) CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do @@ -32,10 +31,6 @@ class TagTest < ActiveSupport::TestCase end context "A tag category fetcher" do - setup do - MEMCACHE.flush_all - end - should "fetch for a single tag" do FactoryGirl.create(:artist_tag, :name => "test") assert_equal(Tag.categories.artist, Tag.category_for("test")) @@ -57,10 +52,6 @@ class TagTest < ActiveSupport::TestCase end context "A tag category mapping" do - setup do - MEMCACHE.flush_all - end - should "exist" do assert_nothing_raised {Tag.categories} end @@ -97,10 +88,6 @@ class TagTest < ActiveSupport::TestCase end context "A tag" do - setup do - MEMCACHE.flush_all - end - should "be lockable by a moderator" do @tag = FactoryGirl.create(:tag) @tag.update_attributes({:is_locked => true}, :as => :moderator) @@ -123,11 +110,11 @@ class TagTest < ActiveSupport::TestCase should "reset its category after updating" do tag = FactoryGirl.create(:artist_tag) tag.update_category_cache_for_all - assert_equal(Tag.categories.artist, MEMCACHE.get("tc:#{tag.name}")) + assert_equal(Tag.categories.artist, Cache.get("tc:#{tag.name}")) tag.update_attribute(:category, Tag.categories.copyright) tag.update_category_cache_for_all - assert_equal(Tag.categories.copyright, MEMCACHE.get("tc:#{tag.name}")) + assert_equal(Tag.categories.copyright, Cache.get("tc:#{tag.name}")) end end diff --git a/test/unit/upload_test.rb b/test/unit/upload_test.rb index 03a68ea67..ed2f526f2 100644 --- a/test/unit/upload_test.rb +++ b/test/unit/upload_test.rb @@ -17,7 +17,6 @@ class UploadTest < ActiveSupport::TestCase user = FactoryGirl.create(:contributor_user) CurrentUser.user = user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/user_feedback_test.rb b/test/unit/user_feedback_test.rb index e700291f8..f98d5189f 100644 --- a/test/unit/user_feedback_test.rb +++ b/test/unit/user_feedback_test.rb @@ -4,7 +4,6 @@ class UserFeedbackTest < ActiveSupport::TestCase context "A user's feedback" do setup do CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index f9f4f2a3d..059e27b8a 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -6,7 +6,6 @@ class UserTest < ActiveSupport::TestCase @user = FactoryGirl.create(:user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" - MEMCACHE.flush_all end teardown do diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb index cd1f97b39..3c91e9410 100644 --- a/test/unit/wiki_page_test.rb +++ b/test/unit/wiki_page_test.rb @@ -2,7 +2,6 @@ require 'test_helper' class WikiPageTest < ActiveSupport::TestCase setup do - MEMCACHE.flush_all CurrentUser.ip_addr = "127.0.0.1" end