提交 10cab35d 编写于 作者: A Andre Arko 提交者: Santiago Pastorino

Allow page_cache_directory to be set as a Pathname

For example, page_cache_directory = Rails.root.join("public/cache")
Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
上级 cf9324e5
......@@ -106,7 +106,7 @@ def page_cache_file(path, extension)
end
def page_cache_path(path, extension = nil)
page_cache_directory + page_cache_file(path, extension)
page_cache_directory.to_s + page_cache_file(path, extension)
end
def instrument_page_cache(name, path)
......
......@@ -156,6 +156,17 @@ def test_page_caching_conditional_options
assert_page_not_cached :ok
end
def test_page_caching_directory_set_as_pathname
begin
ActionController::Base.page_cache_directory = Pathname.new(FILE_STORE_PATH)
get :ok
assert_response :ok
assert_page_cached :ok
ensure
ActionController::Base.page_cache_directory = FILE_STORE_PATH
end
end
private
def assert_page_cached(action, message = "#{action} should have been cached")
assert page_cached?(action), message
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册