Ruby on rails 使用;“可路由”;共享示例中的matcher?

Ruby on rails 使用;“可路由”;共享示例中的matcher?,ruby-on-rails,rspec,ruby-on-rails-3.2,Ruby On Rails,Rspec,Ruby On Rails 3.2,在共享示例中,似乎使用“be_routable”匹配器,不在控制器或路由子目录中是不可能的 如果我尝试 expect(get :edit, id: 1).not_to be_routable 我犯了一个错误 Failure/Error: expect(get :edit, id: 1).not_to be_routable ActionController::RoutingError: No route matches {:id=>"1", :controller=>"lea

在共享示例中,似乎使用“be_routable”匹配器,不在控制器或路由子目录中是不可能的

如果我尝试

expect(get :edit, id: 1).not_to be_routable
我犯了一个错误

Failure/Error: expect(get :edit, id: 1).not_to be_routable
ActionController::RoutingError:
   No route matches {:id=>"1", :controller=>"leads", :action=>"edit"}
我在controller目录中包含了这个共享示例,所以我想这应该可以

我已经尝试将“type::controller”添加到描述中,但似乎无法解决问题


关于如何解决这个问题有什么建议吗?

从Peter的第一个答案开始,我终于开始逐字检查语法,它不起作用的原因是。。。冒号。如果你改变

expect(get :edit, id: 1).not_to be_routable


它就像一个符咒

很抱歉。我指给您看的文档是2.4版的,后来已经更改了。我以前从未真正注意到使用
expect
的这种方式,其中缺少第一个参数(通常是比较的值),匹配器只是使用与之配套的可选参数。很抱歉搞混了,但我确实学到了一些东西。事实上,我得出了同样的结论,当我看到你的答案时,我正在发布一个修改后的答案+一是正确,二是痛苦。
expect(get: :edit, id: 1).not_to be_routable