class CacheStoreLoggerTest

Public Instance Methods

setup() click to toggle source
# File activesupport/test/cache/cache_store_logger_test.rb, line 7
def setup
  @cache = ActiveSupport::Cache.lookup_store(:memory_store)

  @buffer = StringIO.new
  @cache.logger = ActiveSupport::Logger.new(@buffer)
end
test_log_with_proc_namespace() click to toggle source
# File activesupport/test/cache/cache_store_logger_test.rb, line 24
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
test_log_with_string_namespace() click to toggle source
# File activesupport/test/cache/cache_store_logger_test.rb, line 19
def test_log_with_string_namespace
  @cache.fetch("foo", namespace: "string_namespace") { "bar" }
  assert_match %r{string_namespace:foo}, @buffer.string
end
test_logging() click to toggle source
# File activesupport/test/cache/cache_store_logger_test.rb, line 14
def test_logging
  @cache.fetch("foo") { "bar" }
  assert @buffer.string.present?
end
test_mute_logging() click to toggle source
# File activesupport/test/cache/cache_store_logger_test.rb, line 32
def test_mute_logging
  @cache.mute { @cache.fetch("foo") { "bar" } }
  assert @buffer.string.blank?
end