aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
diff options
context:
space:
mode:
authorWinston <winston.yongwei@gmail.com>2012-02-22 19:19:05 +0800
committerWinston <winston.yongwei@gmail.com>2012-02-22 19:19:05 +0800
commitb52c66f1bedb6ed5a08c106a199a53f67c9f6ec2 (patch)
tree981071c71d10d4df2d1dc8bcd404ccd407669fe0 /activesupport/test/caching_test.rb
parenta95f730ea45f01744702849fc084b4d28c857964 (diff)
downloadrails-b52c66f1bedb6ed5a08c106a199a53f67c9f6ec2.tar.gz
rails-b52c66f1bedb6ed5a08c106a199a53f67c9f6ec2.tar.bz2
rails-b52c66f1bedb6ed5a08c106a199a53f67c9f6ec2.zip
#read_entry in ActiveSupport::Cache::FileStore should log details of the exception when an exception is thrown.
Diffstat (limited to 'activesupport/test/caching_test.rb')
-rw-r--r--activesupport/test/caching_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index b03865da93..d6aefa6629 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -549,6 +549,9 @@ class FileStoreTest < ActiveSupport::TestCase
@cache = ActiveSupport::Cache.lookup_store(:file_store, cache_dir, :expires_in => 60)
@peek = ActiveSupport::Cache.lookup_store(:file_store, cache_dir, :expires_in => 60)
@cache_with_pathname = ActiveSupport::Cache.lookup_store(:file_store, Pathname.new(cache_dir), :expires_in => 60)
+
+ @buffer = StringIO.new
+ @cache.logger = ActiveSupport::Logger.new(@buffer)
end
def teardown
@@ -591,6 +594,12 @@ class FileStoreTest < ActiveSupport::TestCase
ActiveSupport::Cache::FileStore.new('/test/cache/directory').delete_matched(/does_not_exist/)
end
end
+
+ def test_log_exception_when_cache_read_fails
+ File.expects(:exist?).raises(StandardError, "failed")
+ @cache.send(:read_entry, "winston", {})
+ assert_present @buffer.string
+ end
end
class MemoryStoreTest < ActiveSupport::TestCase