diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2016-02-18 08:23:26 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2016-02-18 08:23:26 -0800 |
commit | 3239ed48d28f3c0baf4445e6c279107e892b7cab (patch) | |
tree | a9860b5c54a42bd16615ae963341229f6c6698a8 /actionview/test | |
parent | 13c4cc3b5aea02716b7459c0da641438077f5236 (diff) | |
download | rails-3239ed48d28f3c0baf4445e6c279107e892b7cab.tar.gz rails-3239ed48d28f3c0baf4445e6c279107e892b7cab.tar.bz2 rails-3239ed48d28f3c0baf4445e6c279107e892b7cab.zip |
move digest cache on to the DetailsKey object
This moves digest calculation cache on to the details key object.
Before, the digest cache was a class level ivar, and one of the keys was
the hash value of the details key object:
https://github.com/rails/rails/blob/13c4cc3b5aea02716b7459c0da641438077f5236/actionview/lib/action_view/digestor.rb#L28
An object's hash value is not unique, so it's possible for this cache
key to produce colliding keys with no resolution. This commit move
cache on to the details key object itself, so we know that the digests
are always unique per details key object.
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/digestor_test.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index e50caac6d8..9ff5f7126b 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -33,7 +33,6 @@ class TemplateDigestorTest < ActionView::TestCase def teardown Dir.chdir @cwd FileUtils.rm_r @tmp_dir - ActionView::Digestor.cache.clear end def test_top_level_change_reflected @@ -301,12 +300,12 @@ class TemplateDigestorTest < ActionView::TestCase def assert_digest_difference(template_name, options = {}) previous_digest = digest(template_name, options) - ActionView::Digestor.cache.clear + finder.digest_cache.clear yield assert_not_equal previous_digest, digest(template_name, options), "digest didn't change" - ActionView::Digestor.cache.clear + finder.digest_cache.clear end def digest(template_name, options = {}) |