diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-07-09 01:56:45 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-07-09 01:56:45 -0700 |
commit | 90d1a3f723ac6133099127cd888aba8eafbeed08 (patch) | |
tree | 70a682188eb59284d40a337007fa795620b61962 | |
parent | ae85a4aa9875981d64db800377162f078e829f72 (diff) | |
parent | 8471fc0363bf2d8d1bf62daf9ce19e71ed4387a1 (diff) | |
download | rails-90d1a3f723ac6133099127cd888aba8eafbeed08.tar.gz rails-90d1a3f723ac6133099127cd888aba8eafbeed08.tar.bz2 rails-90d1a3f723ac6133099127cd888aba8eafbeed08.zip |
Merge pull request #11354 from jadeatucker/cache_exists_should_return_boolean
cache.exists? should return true/false
-rw-r--r-- | activesupport/lib/active_support/cache.rb | 2 | ||||
-rw-r--r-- | activesupport/test/caching_test.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index c539048a85..308a1b2cd9 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -408,7 +408,7 @@ module ActiveSupport options = merged_options(options) instrument(:exist?, name) do entry = read_entry(namespaced_key(name, options), options) - entry && !entry.expired? + (entry && !entry.expired?) || false end end diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index ae6eaa4b60..d2382f0f5b 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -327,8 +327,8 @@ module CacheStoreBehavior def test_exist @cache.write('foo', 'bar') - assert @cache.exist?('foo') - assert !@cache.exist?('bar') + assert_equal true, @cache.exist?('foo') + assert_equal false, @cache.exist?('bar') end def test_nil_exist |