如何测试也定义为辅助方法的ApplicationController方法? [英] How to test ApplicationController method defined also as a helper method?
本文介绍了如何测试也定义为辅助方法的ApplicationController方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的ApplicationController中,我有一个定义为辅助方法的方法:
In my ApplicationController I have a method defined as a helper method:
helper_method :some_method_here
- 我该如何在RSpec中测试ApplicationController?
- 在测试视图/帮助器时如何包括/调用此帮助器方法?
我正在将Rails3与RSpec2一起使用
推荐答案
您可以使用测试帮助器的部分, .
You can use an anonymous controller to test your ApplicationController, as describe in the RSpec documentation. There's also a section on testing helpers.
这篇关于如何测试也定义为辅助方法的ApplicationController方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文