Rspec: Controller specs for 2 level nested resources

前端 未结 2 489
傲寒
傲寒 2020-12-17 09:28

my routes.rb

  namespace :magazine do
   resources :pages do
     resources :articles do
       resources :comments
     end
   end
  end

W

2条回答
  •  旧时难觅i
    2020-12-17 10:14

    With Rails 5 the params API changed:

    get :index, params: { page_id: @page.id, article_id: @article.id }
    

    https://relishapp.com/rspec/rspec-rails/v/3-7/docs/request-specs/request-spec#specify-managing-a-widget-with-rails-integration-methods

提交回复
热议问题