Functional test of a resource with explicitly set controller

I explicitly set a controller for a resource and now run in to routing
problems trying to reference it in my functional test.

For example:

=== routes.rb ===
map.resources :companies do |companies|
companies.resources :sent_items, :name_prefix =>
“company_”, :controller => :company_sent_items
end

=== company_sent_items_controller_test.rb ===
def test_should_get_index
get :index, :company_id => users(:john_deere).company.id
assert_whatever
end

I get the following routing error:

test_get_index(CompanySentItemsControllerTest):
ActionController::RoutingError: No route matches
{:controller=>“company_sent_items”, :action=>“index”}

Without making map.connect mappings for the the
CompanySentItemsController how do I form a get request for that
resource?

Thanks,

Jake

The only thing I can see [off hand] is that you’re using a symbol for a
controller name. It’s usually a string. I changed one my routings to use
a
symbol there and it doesn’t seem to work. You might want to try the
string
approach there. :slight_smile:

RSL

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs