开发者

How should one test caches_page?

开发者 https://www.devze.com 2023-02-21 21:20 出处:网络
I开发者_JS百科n a Ror3 project, how would be an elegant way to test if caches_page works as expected in my controllers?If you want to see if the page was cached, you can check for the file in your pub

I开发者_JS百科n a Ror3 project, how would be an elegant way to test if caches_page works as expected in my controllers?


If you want to see if the page was cached, you can check for the file in your public folder. Rails will output a page with a .html extension. If you want to check a subsequent request, then maybe store the original response html (that was cached) and compare that against the subsequent request. Or possibly use the timestamp on the cached file (although I can see that being problematic). Are you looking for a specific implementation in rspec, cucumber, etc..?

0

精彩评论

暂无评论...
验证码 换一张
取 消