aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/cache/stores/redis_cache_store_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/cache/stores/redis_cache_store_test.rb')
-rw-r--r--activesupport/test/cache/stores/redis_cache_store_test.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/activesupport/test/cache/stores/redis_cache_store_test.rb b/activesupport/test/cache/stores/redis_cache_store_test.rb
index cdbb5dc4c6..7c1286a115 100644
--- a/activesupport/test/cache/stores/redis_cache_store_test.rb
+++ b/activesupport/test/cache/stores/redis_cache_store_test.rb
@@ -156,15 +156,26 @@ module ActiveSupport::Cache::RedisCacheStoreTests
class StoreAPITest < StoreTest
end
- class FailureSafetyTest < StoreTest
- test "fetch read failure returns nil" do
+ class UnavailableRedisClient < Redis::Client
+ def ensure_connected
+ raise Redis::BaseConnectionError
end
+ end
- test "fetch read failure does not attempt to write" do
- end
+ class FailureSafetyTest < StoreTest
+ include FailureSafetyBehavior
- test "write failure returns nil" do
- end
+ private
+
+ def emulating_unavailability
+ old_client = Redis.send(:remove_const, :Client)
+ Redis.const_set(:Client, UnavailableRedisClient)
+
+ yield ActiveSupport::Cache::RedisCacheStore.new
+ ensure
+ Redis.send(:remove_const, :Client)
+ Redis.const_set(:Client, old_client)
+ end
end
class DeleteMatchedTest < StoreTest