jrcahoon
2007-Feb-16 22:21 UTC
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Russell Norris
2007-Feb-17 14:56 UTC
Re: Functional test of a resource with explicitly set controller
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. :) RSL On 2/16/07, jrcahoon <jrcahoon-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > 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 > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---