mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #41522 from ghiculescu/file-store-no-path
Require a path for `config.cache_store = :file_store`
This commit is contained in:
commit
8cac41b841
3 changed files with 14 additions and 2 deletions
|
@ -63,7 +63,13 @@ module ActiveSupport
|
|||
case store
|
||||
when Symbol
|
||||
options = parameters.extract_options!
|
||||
retrieve_store_class(store).new(*parameters, **options)
|
||||
# clean this up once Ruby 2.7 support is dropped
|
||||
# see https://github.com/rails/rails/pull/41522#discussion_r581186602
|
||||
if options.empty?
|
||||
retrieve_store_class(store).new(*parameters)
|
||||
else
|
||||
retrieve_store_class(store).new(*parameters, **options)
|
||||
end
|
||||
when Array
|
||||
lookup_store(*store)
|
||||
when nil
|
||||
|
|
|
@ -20,7 +20,7 @@ module ActiveSupport
|
|||
FILEPATH_MAX_SIZE = 900 # max is 1024, plus some room
|
||||
GITKEEP_FILES = [".gitkeep", ".keep"].freeze
|
||||
|
||||
def initialize(cache_path, options = nil)
|
||||
def initialize(cache_path, **options)
|
||||
super(options)
|
||||
@cache_path = cache_path.to_s
|
||||
end
|
||||
|
|
|
@ -21,6 +21,12 @@ class CacheStoreSettingTest < ActiveSupport::TestCase
|
|||
assert_equal "/path/to/cache/directory", store.cache_path
|
||||
end
|
||||
|
||||
def test_file_store_requires_a_path
|
||||
assert_raises(ArgumentError) do
|
||||
ActiveSupport::Cache.lookup_store :file_store
|
||||
end
|
||||
end
|
||||
|
||||
def test_mem_cache_fragment_cache_store
|
||||
assert_called_with(Dalli::Client, :new, [%w[localhost], {}]) do
|
||||
store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost"
|
||||
|
|
Loading…
Reference in a new issue