diff options
author | John Hawthorn <john@hawthorn.email> | 2019-04-12 10:20:04 -0700 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2019-04-12 12:30:26 -0700 |
commit | 53e4055a75fc16bf31aeb295ec18c07a3059db57 (patch) | |
tree | e4937fa650c63a7e54bd5d01914459c7ae7d2dd3 /actionview/test/template | |
parent | 1fc735e5f584b481eba85670c519731271ac1796 (diff) | |
download | rails-53e4055a75fc16bf31aeb295ec18c07a3059db57.tar.gz rails-53e4055a75fc16bf31aeb295ec18c07a3059db57.tar.bz2 rails-53e4055a75fc16bf31aeb295ec18c07a3059db57.zip |
Support disabling cache for Digestor
This adds a bit of complexity, but is necessary for now to avoid holding
extra copies of templates which are resolved from ActionView::Digestor
after disabling cache on the lookup context.
Diffstat (limited to 'actionview/test/template')
-rw-r--r-- | actionview/test/template/resolver_shared_tests.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionview/test/template/resolver_shared_tests.rb b/actionview/test/template/resolver_shared_tests.rb index 37bdf4b22c..ee73ec1922 100644 --- a/actionview/test/template/resolver_shared_tests.rb +++ b/actionview/test/template/resolver_shared_tests.rb @@ -95,6 +95,20 @@ module ResolverSharedTests assert_same a, b end + def test_different_templates_when_cache_disabled + with_file "test/hello_world.html.erb", "Hello HTML!" + + a = context.find("hello_world", "test", false, [], {}) + b = context.disable_cache { context.find("hello_world", "test", false, [], {}) } + c = context.find("hello_world", "test", false, [], {}) + + # disable_cache should give us a new object + refute_same a, b + + # but it should not clear the cache + assert_same a, c + end + def test_same_template_from_different_details_is_same_object with_file "test/hello_world.html.erb", "Hello plain text!" |