如何在Rails的功能测试中启用页面缓存?
问题描述:
是否可以打开页面缓存进行功能测试?以下无效:
Is it possible to turn on page caching for a functional test? The following didn't work:
class ArticlesControllerTest < ActionController::TestCase
def setup
ActionController::Base.public_class_method :page_cache_path
ActionController::Base.perform_caching = true
end
end
预先感谢
Deb
答
我不知道为什么它不起作用,所以我最终直接在environments/test.rb
上启用了缓存:
I couldn't figure out why this was not working, so I ended up enabling caching directly on environments/test.rb
:
config.action_controller.perform_caching = true