aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/caching_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/caching_test.rb')
-rw-r--r--actionpack/test/controller/caching_test.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index 7bd64e2870..ddc1c68383 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -8,7 +8,8 @@ ActionController::Base.page_cache_directory = FILE_STORE_PATH
ActionController::Base.cache_store = :file_store, FILE_STORE_PATH
class PageCachingTestController < ActionController::Base
- caches_page :ok, :no_content, :found, :not_found
+ caches_page :ok, :no_content, :if => Proc.new { |c| !c.request.format.json? }
+ caches_page :found, :not_found
def ok
head :ok
@@ -127,6 +128,12 @@ class PageCachingTest < Test::Unit::TestCase
end
end
end
+
+ def test_page_caching_conditional_options
+ @request.env['HTTP_ACCEPT'] = 'application/json'
+ get :ok
+ assert_page_not_cached :ok
+ end
private
def assert_page_cached(action, message = "#{action} should have been cached")