From d3b5db8919c61243c45ebd09254de20f4aa0cf1d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 27 May 2007 16:38:02 +0000 Subject: Added custom path cache_page/expire_page parameters in addition to the options hashes [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6868 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/caching_test.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index dcbe27622d..0dc73472cf 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -25,6 +25,16 @@ class PageCachingTestController < ActionController::Base def not_found head :not_found end + + def custom_path + render :text => "Super soaker" + cache_page("Super soaker", "/index.html") + end + + def expire_custom_path + expire_page("/index.html") + head :ok + end end class PageCachingTest < Test::Unit::TestCase @@ -69,6 +79,19 @@ class PageCachingTest < Test::Unit::TestCase assert_page_cached :ok, "get with ok status should have been cached" end + def test_should_cache_with_custom_path + get :custom_path + assert File.exist?("#{FILE_STORE_PATH}/index.html") + end + + def test_should_expire_cache_with_custom_path + get :custom_path + assert File.exist?("#{FILE_STORE_PATH}/index.html") + + get :expire_custom_path + assert !File.exist?("#{FILE_STORE_PATH}/index.html") + end + [:ok, :no_content, :found, :not_found].each do |status| [:get, :post, :put, :delete].each do |method| unless method == :get and status == :ok @@ -96,6 +119,7 @@ class PageCachingTest < Test::Unit::TestCase end end + class ActionCachingTestController < ActionController::Base caches_action :index caches_action :show, :cache_path => 'http://test.host/custom/show' -- cgit v1.2.3