Actions when testing resources with namespaces

Hello,

I have an admin tool in the namespace admin in this way:

map.namespace :admin do |admin|
admin.resources :products
end

and I’ve also have a

map.resources :products

except that the last one is nice (or tries to be) and the first one
allows to
edit, update, create and destroy.

For testing admin/products_controller I have the following code:

class Admin::ProductsControllerTest < ActionController::TestCase
def test_should_create_product
assert_difference(‘Product.count’) do
post :create, :product => {}
end
assert_redirected_to admin_product_path(assigns(:product))
end
end

When I run the test I get

  1. Error:
    test_should_create_product(Admin::ProductsControllerTest):
    NoMethodError: undefined method `product_url’ for
    #Admin::ProductsController:0xb7077684

Well, of course, product_url doesn’t and should not exists. But post
should be
trying to run admin_product_url. How can I make that work?

Thank you.