From 459de6fac3c5a0bcf4c43e221a0a81ab5d81a7f7 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 13 Jun 2012 16:14:11 -0300 Subject: ActionController::Caching depends on RackDelegation and AbstractController::Callbacks --- actionpack/test/metal/caching_test.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 actionpack/test/metal/caching_test.rb (limited to 'actionpack/test/metal/caching_test.rb') diff --git a/actionpack/test/metal/caching_test.rb b/actionpack/test/metal/caching_test.rb new file mode 100644 index 0000000000..a2b6763754 --- /dev/null +++ b/actionpack/test/metal/caching_test.rb @@ -0,0 +1,32 @@ +require 'abstract_unit' + +CACHE_DIR = 'test_cache' +# Don't change '/../temp/' cavalierly or you might hose something you don't want hosed +FILE_STORE_PATH = File.join(File.dirname(__FILE__), '/../temp/', CACHE_DIR) + +class CachingController < ActionController::Metal + abstract! + + include ActionController::Caching + + self.page_cache_directory = FILE_STORE_PATH + self.cache_store = :file_store, FILE_STORE_PATH +end + +class PageCachingTestController < CachingController + caches_page :ok + + def ok + self.response_body = "ok" + end +end + +class PageCachingTest < ActionController::TestCase + tests PageCachingTestController + + def test_should_cache_get_with_ok_status + get :ok + assert_response :ok + assert File.exist?("#{FILE_STORE_PATH}/page_caching_test/ok.html"), "get with ok status should have been cached" + end +end -- cgit v1.2.3