aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2012-06-13 16:14:11 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2012-06-13 16:18:55 -0300
commit7f937914576c65a01f3a9528d1728720c6c400c5 (patch)
treedab18e6b5f56c65e993faea1e46323838e6f8e6f /actionpack
parent966371adec28855fbc36e2e78b9c34e77c81c472 (diff)
downloadrails-7f937914576c65a01f3a9528d1728720c6c400c5.tar.gz
rails-7f937914576c65a01f3a9528d1728720c6c400c5.tar.bz2
rails-7f937914576c65a01f3a9528d1728720c6c400c5.zip
ActionController::Caching depends on RackDelegation and AbstractController::Callbacks
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/caching.rb3
-rw-r--r--actionpack/test/metal/caching_test.rb32
2 files changed, 35 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb
index 112573a38d..9118806059 100644
--- a/actionpack/lib/action_controller/caching.rb
+++ b/actionpack/lib/action_controller/caching.rb
@@ -55,6 +55,9 @@ module ActionController #:nodoc:
end
end
+ include RackDelegation
+ include AbstractController::Callbacks
+
include ConfigMethods
include Pages, Actions, Fragments
include Sweeping if defined?(ActiveRecord)
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