diff options
author | Jason Lee <huacnlee@gmail.com> | 2018-06-29 15:52:12 +0800 |
---|---|---|
committer | Jason Lee <huacnlee@gmail.com> | 2018-06-29 15:52:12 +0800 |
commit | 9d5b02ec5062a23665ec596ef7d3efe4f5abcc27 (patch) | |
tree | 857dc1c83fbec3ba065ab96763a73475159003ea /activesupport/test | |
parent | 79ef9fbe4639954e7f71463a1184489ffec1e5e6 (diff) | |
download | rails-9d5b02ec5062a23665ec596ef7d3efe4f5abcc27.tar.gz rails-9d5b02ec5062a23665ec596ef7d3efe4f5abcc27.tar.bz2 rails-9d5b02ec5062a23665ec596ef7d3efe4f5abcc27.zip |
Add :expires_in option support for RedisCacheStore increment/decrement method.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/cache/stores/redis_cache_store_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/activesupport/test/cache/stores/redis_cache_store_test.rb b/activesupport/test/cache/stores/redis_cache_store_test.rb index 24c4c5c481..a2165e1978 100644 --- a/activesupport/test/cache/stores/redis_cache_store_test.rb +++ b/activesupport/test/cache/stores/redis_cache_store_test.rb @@ -141,6 +141,30 @@ module ActiveSupport::Cache::RedisCacheStoreTests end end end + + def test_increment_expires_in + assert_called_with @cache.redis, :incrby, [ "#{@namespace}:foo", 1 ] do + assert_called_with @cache.redis, :expire, [ "#{@namespace}:foo", 60 ] do + @cache.increment("foo", 1, expires_in: 60) + end + end + + assert_not_called @cache.redis, :expire do + @cache.decrement("foo", 1, expires_in: 60) + end + end + + def test_decrement_expires_in + assert_called_with @cache.redis, :decrby, [ "#{@namespace}:foo", 1 ] do + assert_called_with @cache.redis, :expire, [ "#{@namespace}:foo", 60 ] do + @cache.decrement("foo", 1, expires_in: 60) + end + end + + assert_not_called @cache.redis, :expire do + @cache.decrement("foo", 1, expires_in: 60) + end + end end class ConnectionPoolBehaviourTest < StoreTest |