diff options
author | Drew Ulmer <latortuga@gmail.com> | 2012-11-25 22:10:44 -0600 |
---|---|---|
committer | Drew Ulmer <latortuga@gmail.com> | 2012-11-25 22:10:44 -0600 |
commit | 7fb8c670474cf553a3540ac283d30dba02d9ea61 (patch) | |
tree | 98daef3dacbcd1ff83e12f0797c0a75d99bdb6b1 /actionpack/test | |
parent | 0a7ba19dcc2271ad6183041ca79e8766a0d2bc40 (diff) | |
download | rails-7fb8c670474cf553a3540ac283d30dba02d9ea61.tar.gz rails-7fb8c670474cf553a3540ac283d30dba02d9ea61.tar.bz2 rails-7fb8c670474cf553a3540ac283d30dba02d9ea61.zip |
Add explicit opt-out for fragment cache digesting
This add support for sending an explicit opt-out of the "Russian-doll"
cache digest feature on a case-by-case basis. This is useful when cache-
expiration needs to be performed manually and it would be otherwise
difficult to know the exact name of a digested cache key.
More information: https://github.com/rails/cache_digests/pull/16
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 12 | ||||
-rw-r--r-- | actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 65c18dfb64..2428cd7433 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -164,6 +164,9 @@ class FunctionalCachingController < CachingController format.xml end end + + def fragment_cached_without_digest + end end class FunctionalFragmentCachingTest < ActionController::TestCase @@ -200,6 +203,15 @@ CACHED @store.read("views/test.host/functional_caching/html_fragment_cached_with_partial/#{template_digest("functional_caching/_partial", "html")}")) end + def test_skipping_fragment_cache_digesting + get :fragment_cached_without_digest, :format => "html" + assert_response :success + expected_body = "<body>\n<p>ERB</p>\n</body>\n" + + assert_equal expected_body, @response.body + assert_equal "<p>ERB</p>", @store.read("views/nodigest") + end + def test_render_inline_before_fragment_caching get :inline_fragment_cached assert_response :success diff --git a/actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb b/actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb new file mode 100644 index 0000000000..3125583a28 --- /dev/null +++ b/actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb @@ -0,0 +1,3 @@ +<body> +<%= cache 'nodigest', skip_digest: true do %><p>ERB</p><% end %> +</body> |