Skip to content

Commit 5606c35

Browse files
committed
Remove warnings on AS/test/cache/stores
Since the test are skipped when Redis | Memcache are not reacheable two instance variables are not initialized properly but used on teardown blocks, having warnings about undeclared variables: - instance variable @cache not initialized (redis cache store) - instance variable @_stores not initialized (memcache store)
1 parent 26e89c7 commit 5606c35

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

activesupport/test/cache/stores/mem_cache_store_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def setup
5656
end
5757

5858
def after_teardown
59+
return unless defined?(@_stores) # because skipped test
60+
5961
stores, @_stores = @_stores, []
6062
stores.each do |store|
6163
# Eagerly closing Dalli connection avoid file descriptor exhaustion.

activesupport/test/cache/stores/redis_cache_store_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def build(**kwargs)
124124

125125
class StoreTest < ActiveSupport::TestCase
126126
setup do
127+
@cache = nil
127128
skip "redis server is not up" unless REDIS_UP
128129
@namespace = "test-#{SecureRandom.hex}"
129130

0 commit comments

Comments
 (0)