aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-09-04 20:39:50 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-09-04 20:39:50 +0000
commitc2054c42891a9d99385535209e643c878bb42a35 (patch)
treec228343afe6faa2a11f28dbe4020800fbea8a3ec /actionpack/test/controller
parent40c86a7bda56e1927468618bf11fbe30fb9d6ed3 (diff)
downloadrails-c2054c42891a9d99385535209e643c878bb42a35.tar.gz
rails-c2054c42891a9d99385535209e643c878bb42a35.tar.bz2
rails-c2054c42891a9d99385535209e643c878bb42a35.zip
Superseeded by action_caching_test (closes #5173)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5001 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/caching_filestore.rb74
1 files changed, 0 insertions, 74 deletions
diff --git a/actionpack/test/controller/caching_filestore.rb b/actionpack/test/controller/caching_filestore.rb
deleted file mode 100644
index 389ebe02fa..0000000000
--- a/actionpack/test/controller/caching_filestore.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-require 'fileutils'
-require File.dirname(__FILE__) + '/../abstract_unit'
-
-class TestLogDevice < Logger::LogDevice
- attr :last_message, true
-
- def initialize
- @last_message=String.new
- end
-
- def write(message)
- @last_message << message
- end
-
- def clear
- @last_message = String.new
- end
-end
-
-#setup our really sophisticated logger
-TestLog = TestLogDevice.new
-RAILS_DEFAULT_LOGGER = Logger.new(TestLog)
-ActionController::Base.logger = RAILS_DEFAULT_LOGGER
-
-def use_store
- #generate a random key to ensure the cache is always in a different location
- RANDOM_KEY = rand(99999999).to_s
- FILE_STORE_PATH = File.dirname(__FILE__) + '/../temp/' + RANDOM_KEY
- ActionController::Base.perform_caching = true
- ActionController::Base.fragment_cache_store = :file_store, FILE_STORE_PATH
-end
-
-class TestController < ActionController::Base
- caches_action :render_to_cache, :index
-
- def render_to_cache
- render_text "Render Cached"
- end
- alias :index :render_to_cache
-end
-
-class FileStoreTest < Test::Unit::TestCase
- def setup
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- @controller = TestController.new
- @request.host = "hostname.com"
- end
-
- def teardown
- FileUtils.rm_rf(FILE_STORE_PATH)
- end
-
- def test_render_cached
- assert_fragment_cached { get :render_to_cache }
- assert_fragment_hit { get :render_to_cache }
- end
-
-
- private
- def assert_fragment_cached
- yield
- assert(TestLog.last_message.include?("Cached fragment:"), "--ERROR-- FileStore write failed ----")
- assert(!TestLog.last_message.include?("Couldn't create cache directory:"), "--ERROR-- FileStore create directory failed ----")
- TestLog.clear
- end
-
- def assert_fragment_hit
- yield
- assert(TestLog.last_message.include?("Fragment read:"), "--ERROR-- Fragment not found in FileStore ----")
- assert(!TestLog.last_message.include?("Cached fragment:"), "--ERROR-- Did cache ----")
- TestLog.clear
- end
-end \ No newline at end of file