diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 0f848c59338cc0fc469e44a9e623ae9a34600a91..83174d3a85e4ab78bc7f170e5a23178a6f96a0c0 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -138,7 +138,7 @@ def silence! # cache.fetch("foo") # => nil def fetch(key, options = {}) @logger_off = true - if !options[:force] && ((value = read(key, options)) || exist?(key, options)) + if !options[:force] && value = read(key, options) @logger_off = false log("hit", key, options) value diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index e5105e92a253a86323d5c240b0d6d7145fafbc4b..4e212f1661590966883c34fafb79efd341674341 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -90,27 +90,7 @@ def test_should_read_and_write_nil @cache.write('foo', nil) assert_equal nil, @cache.read('foo') end - - def test_should_read_and_write_false - @cache.write('foo', false) - assert_equal false, @cache.read('foo') - end - - def test_should_read_and_write_true - @cache.write('foo', true) - assert_equal true, @cache.read('foo') - end - - def test_fetch_false_without_cache_miss - @cache.write('foo', false) - assert_equal false, @cache.fetch('foo') { 'baz' } - end - - def test_fetch_nil_without_cache_miss - @cache.write('foo', nil) - assert_equal nil, @cache.fetch('foo') { 'baz' } - end - + def test_fetch_without_cache_miss @cache.write('foo', 'bar') assert_equal 'bar', @cache.fetch('foo') { 'baz' }