简体   繁体   English

Rspec错误:没有路由匹配:显示,:更新,:创建,:索引(所有动作)

[英]Rspec Error: No Route Matches :show, :update, :create, :index (all actions)

In my rspec tests I'm having a problem that I don't think any of my other teammates are having. 在我的rspec测试中,我遇到一个我没有其他队友遇到的问题。 Each call to :show, :create, :update (all actions) comes up with this error: 每次对:show,:create,:update(所有操作)的调用都会出现此错误:

Failure/Error: get :index ActionController::RoutingError: No route matches [GET] "/index".

Note: replace "index" with whatever action being called. 注意:将“ index”替换为要调用的任何动作。

How can I debug this? 我该如何调试? Am I missing something that makes these methods available in my specs? 我是否缺少使这些方法在我的规格中可用的东西?

I have solved this issue. 我已经解决了这个问题。 I discovered in my app that somebody had overwritten the default behavior of the way that controller specs work. 我在我的应用程序中发现有人重写了控制器规范工作方式的默认行为。 The question is really general about why controller action methods would not be available in a controller spec. 问题实际上是关于为何控制器规范中将不提供控制器动作方法的一般问题。 The answer really is that they should be available in your controller spec unless you have overridden that functionality in some way. 答案确实是,除非您以某种方式覆盖了该功能,否则它们应该在您的控制器规格中可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM