diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2012-08-29 14:23:15 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2012-08-29 14:23:56 -0500 |
commit | 502d5e24e28b3634910495d0fb71cb20b1426aee (patch) | |
tree | ed4c626e6ff62c826c7837660bcb0b74ea8393e4 /actionpack/test/controller | |
parent | 3da10e3261c60b98bb24f2e56ad3829499252663 (diff) | |
download | rails-502d5e24e28b3634910495d0fb71cb20b1426aee.tar.gz rails-502d5e24e28b3634910495d0fb71cb20b1426aee.tar.bz2 rails-502d5e24e28b3634910495d0fb71cb20b1426aee.zip |
Add automatic template digests to all CacheHelper#cache calls (originally spiked in the cache_digests plugin) *DHH*
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 0efba5b77f..2c3511f6a0 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -854,14 +854,17 @@ Ciao CACHED assert_equal expected_body, @response.body - assert_equal "This bit's fragment cached", @store.read('views/test.host/functional_caching/fragment_cached') + assert_equal "This bit's fragment cached", + @store.read("views/test.host/functional_caching/fragment_cached/#{template_digest("functional_caching/fragment_cached", "html")}") end def test_fragment_caching_in_partials get :html_fragment_cached_with_partial assert_response :success assert_match(/Old fragment caching in a partial/, @response.body) - assert_match("Old fragment caching in a partial", @store.read('views/test.host/functional_caching/html_fragment_cached_with_partial')) + + assert_match("Old fragment caching in a partial", + @store.read("views/test.host/functional_caching/html_fragment_cached_with_partial/#{template_digest("functional_caching/_partial", "html")}")) end def test_render_inline_before_fragment_caching @@ -869,7 +872,8 @@ CACHED assert_response :success assert_match(/Some inline content/, @response.body) assert_match(/Some cached content/, @response.body) - assert_match("Some cached content", @store.read('views/test.host/functional_caching/inline_fragment_cached')) + assert_match("Some cached content", + @store.read("views/test.host/functional_caching/inline_fragment_cached/#{template_digest("functional_caching/inline_fragment_cached", "html")}")) end def test_html_formatted_fragment_caching @@ -879,7 +883,8 @@ CACHED assert_equal expected_body, @response.body - assert_equal "<p>ERB</p>", @store.read('views/test.host/functional_caching/formatted_fragment_cached') + assert_equal "<p>ERB</p>", + @store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached", "html")}") end def test_xml_formatted_fragment_caching @@ -889,8 +894,14 @@ CACHED assert_equal expected_body, @response.body - assert_equal " <p>Builder</p>\n", @store.read('views/test.host/functional_caching/formatted_fragment_cached') + assert_equal " <p>Builder</p>\n", + @store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached", "xml")}") end + + private + def template_digest(name, format) + ActionView::Digestor.digest(name, format, @controller.lookup_context) + end end class CacheHelperOutputBufferTest < ActionController::TestCase |