aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorjosevalim <jose.valim@gmail.com>2008-06-14 10:45:32 +0200
committerPratik Naik <pratiknaik@gmail.com>2008-07-04 02:00:51 +0100
commitbad1eac91d1549631dca8e93e7e846911649acf7 (patch)
tree2ee30ac1ac7451d9a0a40c02481d13f74f3fc9d4 /actionpack/test
parent87fbcaa6229e9073095fb8d77c7a536c9466fbce (diff)
downloadrails-bad1eac91d1549631dca8e93e7e846911649acf7.tar.gz
rails-bad1eac91d1549631dca8e93e7e846911649acf7.tar.bz2
rails-bad1eac91d1549631dca8e93e7e846911649acf7.zip
Allow caches_action to accept cache store options. [#416 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/caching_test.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index 0140654155..d8a3ccb35b 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -152,7 +152,7 @@ end
class ActionCachingTestController < ActionController::Base
- caches_action :index, :redirected, :forbidden, :if => Proc.new { |c| !c.request.format.json? }
+ caches_action :index, :redirected, :forbidden, :if => Proc.new { |c| !c.request.format.json? }, :expires_in => 1.hour
caches_action :show, :cache_path => 'http://test.host/custom/show'
caches_action :edit, :cache_path => Proc.new { |c| c.params[:id] ? "http://test.host/#{c.params[:id]};edit" : "http://test.host/edit" }
caches_action :with_layout
@@ -188,6 +188,7 @@ class ActionCachingTestController < ActionController::Base
expire_action :controller => 'action_caching_test', :action => 'index'
render :nothing => true
end
+
def expire_xml
expire_action :controller => 'action_caching_test', :action => 'index', :format => 'xml'
render :nothing => true
@@ -289,6 +290,13 @@ class ActionCacheTest < Test::Unit::TestCase
assert !fragment_exist?('hostname.com/action_caching_test')
end
+ def test_action_cache_with_store_options
+ MockTime.expects(:now).returns(12345).once
+ @controller.expects(:read_fragment).with('hostname.com/action_caching_test', :expires_in => 1.hour).once
+ @controller.expects(:write_fragment).with('hostname.com/action_caching_test', '12345.0', :expires_in => 1.hour).once
+ get :index
+ end
+
def test_action_cache_with_custom_cache_path
get :show
cached_time = content_to_cache