我正在使用inherited_resources,我有一个控制器,如:
class Admin::PostsController < InheritedResources::Base
end
Run Code Online (Sandbox Code Playgroud)
在我的控制器测试中:
it "redirects to the post" do
post = Post.create! valid_attributes
put :update, {:id => post.to_param, :post => valid_attributes}, valid_session
response.should redirect_to([:admin, post])
end
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
undefined method `posts_url' for #<Admin::PostsController:0xec6fb20>
Run Code Online (Sandbox Code Playgroud)
奇怪的是,它只发生在测试中!应用程序运行正常.
我错过了什么?
[编辑]我发现此问题报告,但没有回答就关闭了https://github.com/josevalim/inherited_resources/issues/193
[编辑]我刚刚发现它为什么会发生并在上述问题页面上做出回应