【发布时间】:2013-02-23 07:20:15
【问题描述】:
我正在使用inherited_resources,并且我有一个控制器,例如:
class Admin::PostsController < InheritedResources::Base
end
在我的控制器测试中:
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
我收到此错误:
undefined method `posts_url' for #<Admin::PostsController:0xec6fb20>
奇怪的是它只发生在测试中!应用程序运行正常。
我错过了什么?
[编辑] 我发现此问题已报告,但在没有答案的情况下关闭 https://github.com/josevalim/inherited_resources/issues/193
[编辑] 我刚刚找到了它发生的原因并在上面的问题页面上做出了回应
【问题讨论】:
-
您可以在此处发布答案或关闭问题以使其不显示为“未回答”吗?
标签: ruby-on-rails ruby rspec namespaces