aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-06-29 10:59:37 +0200
committerGitHub <noreply@github.com>2018-06-29 10:59:37 +0200
commit4883f73978355a572856a6c26b7a6dcbc828f2fd (patch)
treeb6ee2cad58a0fda333dd8d63f9971e9b3ed37ae3 /activesupport/test
parent11505cc2b3b24f7b1f0aa1585fbe4830885593ca (diff)
parent9d5b02ec5062a23665ec596ef7d3efe4f5abcc27 (diff)
downloadrails-4883f73978355a572856a6c26b7a6dcbc828f2fd.tar.gz
rails-4883f73978355a572856a6c26b7a6dcbc828f2fd.tar.bz2
rails-4883f73978355a572856a6c26b7a6dcbc828f2fd.zip
Merge pull request #33254 from huacnlee/add-expires-in-option-support-for-redis-cache-store-increment-method
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.rb24
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