diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-08-08 12:46:44 -0300 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-08-08 12:46:44 -0300 |
commit | efcfce50c417975ee038a107755a1542a690d39b (patch) | |
tree | 4c4625a5a668f6a2b462081ea73dbe55e9fb4254 /actionpack/test/controller | |
parent | 0fbeaa98e4e60ca0949be298dae8545807407e1d (diff) | |
download | rails-efcfce50c417975ee038a107755a1542a690d39b.tar.gz rails-efcfce50c417975ee038a107755a1542a690d39b.tar.bz2 rails-efcfce50c417975ee038a107755a1542a690d39b.zip |
Fixes "Cached fragment hit" written to log even if fragment is not cached (Erik Andrejko) [#2917 state:resolved]
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index c286976315..68529cc8f7 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -625,6 +625,21 @@ class FragmentCachingTest < ActionController::TestCase assert !fragment_computed assert_equal 'generated till now -> fragment content', buffer end + + def test_fragment_for_logging + fragment_computed = false + + @controller.class.expects(:benchmark).with('Cached fragment exists?: views/expensive') + @controller.class.expects(:benchmark).with('Cached fragment miss: views/expensive') + @controller.class.expects(:benchmark).with('Cached fragment hit: views/expensive').never + + buffer = 'generated till now -> ' + @controller.fragment_for(buffer, 'expensive') { fragment_computed = true } + + assert fragment_computed + assert_equal 'generated till now -> ', buffer + end + end class FunctionalCachingController < ActionController::Base |