mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Restore the lookup_store
compatibility to accept config as a single object
fa986ae
broke the `lookup_store` compatibility. It's public API so
deprecation cycle is required if we want to make a breaking change.
This commit is contained in:
parent
667d69cc5b
commit
c728f8ec97
2 changed files with 10 additions and 0 deletions
|
@ -59,6 +59,8 @@ module ActiveSupport
|
|||
when Symbol
|
||||
options = parameters.extract_options!
|
||||
retrieve_store_class(store).new(*parameters, **options)
|
||||
when Array
|
||||
lookup_store(*store)
|
||||
when nil
|
||||
ActiveSupport::Cache::MemoryStore.new
|
||||
else
|
||||
|
|
|
@ -66,6 +66,14 @@ class CacheStoreSettingTest < ActiveSupport::TestCase
|
|||
assert_equal "/path/to/cache/directory", store.cache_path
|
||||
end
|
||||
|
||||
def test_redis_cache_store_with_single_array_object
|
||||
cache_store = [:redis_cache_store, namespace: "foo"]
|
||||
|
||||
store = ActiveSupport::Cache.lookup_store(cache_store)
|
||||
assert_kind_of ActiveSupport::Cache::RedisCacheStore, store
|
||||
assert_equal "foo", store.options[:namespace]
|
||||
end
|
||||
|
||||
def test_redis_cache_store_with_ordered_options
|
||||
options = ActiveSupport::OrderedOptions.new
|
||||
options.update namespace: "foo"
|
||||
|
|
Loading…
Reference in a new issue