如何在Rails的功能测试中启用页面缓存? [英] How to enable page caching in a functional test in rails?
本文介绍了如何在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
这篇关于如何在Rails的功能测试中启用页面缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文