aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAvner Cohen <israbirding@gmail.com>2013-08-13 22:22:56 +0300
committerAvner Cohen <israbirding@gmail.com>2015-06-23 23:07:19 +0300
commitf654d658f2dab5f4dcc42b2d0c308b4d806dc491 (patch)
treeace5e61d3841679b0cb509e817581bcd3b7db919 /activesupport/test
parent1022796ac075a5f1a3ca45f4d48284d4bfa2567a (diff)
downloadrails-f654d658f2dab5f4dcc42b2d0c308b4d806dc491.tar.gz
rails-f654d658f2dab5f4dcc42b2d0c308b4d806dc491.tar.bz2
rails-f654d658f2dab5f4dcc42b2d0c308b4d806dc491.zip
When logging Cache key, in debug mode, also log namespace, to create the full key that actually used by the underline cache implementation
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/caching_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index 8e22d4ed2f..322d058696 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -1045,6 +1045,19 @@ class CacheStoreLoggerTest < ActiveSupport::TestCase
assert @buffer.string.present?
end
+ def test_log_with_string_namespace
+ @cache.fetch('foo', {namespace: 'string_namespace'}) { 'bar' }
+ assert_match %r{string_namespace:foo}, @buffer.string
+ end
+
+ def test_log_with_proc_namespace
+ proc = Proc.new do
+ "proc_namespace"
+ end
+ @cache.fetch('foo', {:namespace => proc}) { 'bar' }
+ assert_match %r{proc_namespace:foo}, @buffer.string
+ end
+
def test_mute_logging
@cache.mute { @cache.fetch('foo') { 'bar' } }
assert @buffer.string.blank?