Тестирование вложенных ресурсов с помощью RSpec

Я пытаюсь создать тесты для вложенных ресурсов в Rails. Соответствующее определение маршрута:

resources :communities do
  resources :contents, :type => 'Content'
end

Используя RSpec и factory_girl, я пытаюсь начать тестирование, например, с помощью

describe ContentsController do
  it 'should display a content item under a community' do
    content = FactoryGirl.create(:content)
    get :show, :community_id => content.community.id, :id => content.id
  end
end

Эти запросы всегда приводят к

Failure/Error: get :show, :community_id => content.community.id, :id => content.id
 ActionController::RoutingError:
   No route matches {:community_id=>BSON::ObjectId('4e7773c6ac54c3d1ad000002'),
   :id=>BSON::ObjectId('4e7773c6ac54c3d1ad000001'), :controller=>"contents",
   :action=>"show"}

На всю жизнь я не могу найти способ указать маршрут к вложенному ресурсу с помощью RSpec. Я делаю здесь что-то в корне не так?

Обновление: релевантная часть рейк-маршрутов:

    community_contents GET    /communities/:community_id/contents(.:format)             {:action=>"index", :controller=>"contents"}
                       POST   /communities/:community_id/contents(.:format)             {:action=>"create", :controller=>"contents"}
 new_community_content GET    /communities/:community_id/contents/new(.:format)         {:action=>"new", :controller=>"contents"}
edit_community_content GET    /communities/:community_id/contents/:id/edit(.:format)    {:action=>"edit", :controller=>"contents"}
     community_content GET    /communities/:community_id/contents/:id(.:format)         {:action=>"show", :controller=>"contents"}
                       PUT    /communities/:community_id/contents/:id(.:format)         {:action=>"update", :controller=>"contents"}
                       DELETE /communities/:community_id/contents/:id(.:format)         {:action=>"destroy", :controller=>"contents"}
5
задан Sami 19 September 2011 в 17:46
поделиться