Skip to content
Browse files

Merge pull request #11354 from jadeatucker/cache_exists_should_return…

…_boolean

cache.exists? should return true/false
  • Loading branch information...
2 parents ae85a4a + 8471fc0 commit 90d1a3f723ac6133099127cd888aba8eafbeed08 @rafaelfranca rafaelfranca committed Jul 9, 2013
Showing with 3 additions and 3 deletions.
  1. +1 −1 activesupport/lib/active_support/cache.rb
  2. +2 −2 activesupport/test/caching_test.rb
View
2 activesupport/lib/active_support/cache.rb
@@ -408,7 +408,7 @@ def exist?(name, options = nil)
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
View
4 activesupport/test/caching_test.rb
@@ -327,8 +327,8 @@ def test_keys_are_case_sensitive
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

0 comments on commit 90d1a3f

Please sign in to comment.
Something went wrong with that request. Please try again.