Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Namespaced controller testing error on resource_url (inherited_resources)

I am using inherited_resources and I have a controller like:

class Admin::PostsController < InheritedResources::Base
end

And in my controller test:

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

I am getting this error:

undefined method `posts_url' for #<Admin::PostsController:0xec6fb20>

The weird part is that it is only happening in the tests! The application runs ok.

What am I missing?

[EDIT] I found this issue reported, but was closed without an answer https://github.com/josevalim/inherited_resources/issues/193

[EDIT] I just found why it is happening and responded on the above issue page

like image 987
rafaelkin Avatar asked Nov 13 '22 10:11

rafaelkin


1 Answers

have u tried this:

response.should redirect_to '/your_url'

it may be solved your problem.

like image 125
Awais Avatar answered Nov 15 '22 04:11

Awais